add new solutions
This commit is contained in:
parent
71189b61cf
commit
9c2c959a9b
10 changed files with 349 additions and 8 deletions
14
solutions/9/q961/solution.go
Normal file
14
solutions/9/q961/solution.go
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
package q961
|
||||
|
||||
import "math/rand"
|
||||
|
||||
func repeatedNTimes(nums []int) int {
|
||||
for {
|
||||
a, b := rand.Intn(len(nums)), rand.Intn(len(nums))
|
||||
if b != a && nums[a] == nums[b] {
|
||||
return nums[a]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var _ = repeatedNTimes
|
||||
Loading…
Add table
Add a link
Reference in a new issue