Complete the code to find the middle index in binary search.
mid := (low + [1]) / 2
In binary search, the middle index is calculated by adding low and high indices and dividing by 2.
Complete the code to update the low index when target is greater than middle element.
if target > arr[mid] { [1] = mid + 1 }
If the target is greater than the middle element, we move the low index to mid + 1 to search the right half.
Fix the error in the loop condition to correctly run binary search.
for low [1] high { mid := (low + high) / 2 // rest of code }
The loop should continue while low is less than or equal to high to cover all elements.
Fill both blanks to create a map of word lengths for words longer than 3 characters.
lengths := map[string]int{}
for _, word := range words {
if len(word) [1] 3 {
lengths[word] = [2]
}
}We check if word length is greater than 3, then store the length in the map.
Fill all three blanks to create a filtered map with uppercase keys and values greater than 0.
filtered := map[string]int{}
for k, v := range data {
if v [1] 0 {
filtered[[2]] = v
}
}
// Convert keys to uppercase
for k := range filtered {
newKey := [3]
filtered[newKey] = filtered[k]
delete(filtered, k)
}We filter values greater than 0, keep original keys, then convert keys to uppercase.