copilot problematic

mail@pastecode.io avatar
unknown
golang
a year ago
466 B
4
Indexable
Never
func unkownFunc(nrOfUnique int, sequence string) int {
	i := nrOfUnique - 1
	for {
		if i >= len(sequence) {
			break
		}
		minIndex := i - nrOfUnique + 1
		charBits := 1 << (uint32(sequence[i]) % 32)
		for j := i - 1; j >= minIndex; j-- {
			currCharBit := 1 << (uint32(sequence[j]) % 32)
			if charBits&currCharBit != 0 {
				i = j + nrOfUnique
				break
			}

			charBits = charBits | currCharBit

			if j == minIndex {
				return i + 1
			}
		}
	}

	return -1
}