1 Million entries is not that large so we can still solve it naively.
module ExampleSolution let findUniqueNumber arr = arr |> Seq.countBy id |> Seq.find (fun (_, count) -> count = 1) |> fst
- module ExampleSolution
let findUniqueNumber array =() // your code goes here- let findUniqueNumber arr =
- arr
- |> Seq.countBy id
- |> Seq.find (fun (_, count) -> count = 1)
- |> fst
using System.Linq; public class Program { public static int FindSquaresInArray(int[] arr) => arr.Sum(x => x*x); }
- using System.Linq;
- public class Program
- {
public static int FindSquaresInArray(int[] arr){int sum = 0;foreach(int n in arr){sum += n * n;}return sum;}- public static int FindSquaresInArray(int[] arr) => arr.Sum(x => x*x);
- }