add new solutions
This commit is contained in:
parent
886b5e0a8e
commit
67cad91898
47 changed files with 1549 additions and 1 deletions
18
solutions/33/q3315/solution.go
Normal file
18
solutions/33/q3315/solution.go
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
package q3315
|
||||
|
||||
func minBitwiseArray(nums []int) []int {
|
||||
for i, num := range nums {
|
||||
if num == 2 {
|
||||
nums[i] = -1
|
||||
continue
|
||||
}
|
||||
|
||||
t := 1
|
||||
for ; num|(t<<1) == num; t <<= 1 {
|
||||
}
|
||||
nums[i] = num - t
|
||||
}
|
||||
return nums
|
||||
}
|
||||
|
||||
var _ = minBitwiseArray
|
||||
Loading…
Add table
Add a link
Reference in a new issue