Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- My:
- object FindTheOddInt {
- def findOdd(xs: Seq[Int], index:Int=0): Int = {
- if(xs.count(x=>x==xs(index))%2==0) findOdd(xs, index+1)
- else xs(index)
- }
- }
- Other:
- object FindTheOddInt {
- def findOdd(xs: Seq[Int]): Int = xs.reduce(_ ^ _)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement