Skip to content

Instantly share code, notes, and snippets.

View isteshkov's full-sized avatar
🙌

ilya steshkov isteshkov

🙌
View GitHub Profile
package main
import (
"bufio"
"io"
"io/ioutil"
"github.com/h2non/filetype"
)
func search(nums []int, target int) int {
low := 0
high := len(nums)-1
for low <= high {
mid := low + (high - low)/2
guess := nums[mid]
if guess == target {
return mid
}
func canConstruct(ransomNote string, magazine string) bool {
for _, v := range ransomNote {
sym := string(v)
ind, exists := searchInString(magazine, sym)
if !exists {
return false
}
magazine = magazine[:ind] + magazine[ind+1:]
}