add new solutions
This commit is contained in:
parent
67cad91898
commit
81cc2d3ba6
19 changed files with 693 additions and 14 deletions
18
solutions/17/q1700/solution.go
Normal file
18
solutions/17/q1700/solution.go
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
package q1700
|
||||
|
||||
func countStudents(students []int, sandwiches []int) int {
|
||||
wants := [2]int{}
|
||||
for _, w := range students {
|
||||
wants[w]++
|
||||
}
|
||||
|
||||
for _, s := range sandwiches {
|
||||
if wants[s] == 0 {
|
||||
return wants[0] + wants[1]
|
||||
}
|
||||
wants[s]--
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
var _ = countStudents
|
||||
Loading…
Add table
Add a link
Reference in a new issue