26
C-sucks
3y

Me at an interview...
interviewer: can u solve a 3-sum problem
me: sir, a threesome is not a problem
interviewer: not threesome, 3-sum
me: OOOOO! that makes sense

Comments
  • 5
    Wrong category.
  • 4
    Bloody hell 🤣🤣
  • 3
    You find out later they like the cut of your jib and invite you over to their home for some 1 on 1 time, but later find out there is an unexpected extra waiting there for you.
  • 0
    Damn haven’t done algos in a while. Just thought of a solution (“length” means length of the array) :
    Create a map with each number from index 2 to index length-2 as a key mapping to the highest index where that num is found. Then create a double for loop:
    for(i=0...length-2)
    for(j=1...length-1)
    Each iteration, take the sum of the numbers at the two current indexes, subtract it from the target, and see if it exists in the map. If it does, check to see if the index mapped by that number is different from indexes i and j and if it is, u win.

    Sorry I got giddy when I realized my algos didn’t totally disappear after doing web dev stuff lol
  • 0
    It depends whether the threesome is MFM or FMF.

    If it's the latter then me competing with two women for bigger tits could be a problem:/
  • 1
    Is this just another algo for testing that isn't really used IRL? Most of the code I write is going through sorted lists. Or joining multiple lists and makes decisions based upon those joins. It may or may not involve sorting or filtering.

    I find structure of the program often is more important than the gearing.
Add Comment