I love doing this with miners , great to know you can do it against hogs <| sep |> Roberts ! !! Plz <| sep |> Roberts , almost , bud . almost <| sep |> Bray has a dope rap album cover ready to go . e 4 e 10 b 984 ebfa 8 a 5545 ee 482 d 40 a 52 e 1 . jpg <| sep |> It ' s not a math concept . Some of it is memorization , in that you need to know different data structures and algos , including their operations and big oh times , if you want to be able to solve problems with specific big oh time requirements . And part of it is just being willing to try doing different things , and to try combining things . Are you closer to solving your problem if you put the array into a BST or a hashmap , or if you sort the array ? And by closer , I mean have you not already made the big oh time too large . Can you combine putting elements into a data structure with checking existing elements ? What does sorting or putting the elements into a BST do for you ? You should know it gives you log n lookup times , which is better than your n 2 nested loops solution . You should know sorting something is n log n , unless you can do radix sort .