Employment Hero | Senior Backend Engineer

employment hero logo
employment hero
Senior Backend Engineer
July 10, 20254 reads

Summary

This interview for a Senior Backend Engineer role at Employment Hero involved two distinct algorithmic problems: one on validating if a sequence of moves forms a rectangle and another on detecting and ranking poker-like hands from a given set of cards.

Full Experience

Problem #1

  • Given a list of moves (<, >, v, ^) starting from (0,0) in a x,y coordinates. Determine if the path form a rectangle. Moves are guarantee to not duplicated

Example

  • >^v< => true
  • >^^v< => false

Problem #2

  • Given a set of cards with suit and rank (suit: S, D, H, C), (rank: 2,3,...,10,J,Q,K,A)
  • Detect if these sets of cards can be form (each set has different strong level - single: weakest, triple and pair: strongest)
    • Single: highest ranked card (suit doesn't matter)
    • Pair: 2 cards with the same rank (suit doesn't matter). If there are multiple answers, select the highest rank
    • Triple: 3 cards with the same rank (suit doesn't matter). If there are multiple answers, select the highest rank
    • Five consecutive cards: 5 cards consecutive increasing rank (e.g 2S, 3A, 4D, 5H, 6A). If there are multiple ans, select the one with the highest rank
    • Suit: 5 cards with the same suit (e.g [10S, 2S, 4S, JS, 5S])
    • Triple and a pair: has 2 cards with the same rank and 3 cards with the same rank (e.g [10S, 10A, 10H, 2S, 2H, 2D, 11S, 11H] => [10S, 10A, 10H, 11S, 11H])
  • If there are multiple sets that can be form, return the strongest set

Interview Questions (2)

Q1
Validate Rectangle Path
Data Structures & Algorithms

Given a list of moves (<, >, v, ^) starting from (0,0) in a x,y coordinates. Determine if the path form a rectangle. Moves are guarantee to not duplicated.

Example:

  • >^v< => true
  • >^^v< => false
Q2
Poker Hand Detection and Ranking
Data Structures & Algorithms

Given a set of cards with suit and rank (suit: S, D, H, C), (rank: 2,3,...,10,J,Q,K,A).

Detect if these sets of cards can be form (each set has different strong level - single: weakest, triple and pair: strongest)

  • Single: highest ranked card (suit doesn't matter)
  • Pair: 2 cards with the same rank (suit doesn't matter). If there are multiple answers, select the highest rank
  • Triple: 3 cards with the same rank (suit doesn't matter). If there are multiple answers, select the highest rank
  • Five consecutive cards: 5 cards consecutive increasing rank (e.g 2S, 3A, 4D, 5H, 6A). If there are multiple ans, select the one with the highest rank
  • Suit: 5 cards with the same suit (e.g [10S, 2S, 4S, JS, 5S])
  • Triple and a pair: has 2 cards with the same rank and 3 cards with the same rank (e.g [10S, 10A, 10H, 2S, 2H, 2D, 11S, 11H] => [10S, 10A, 10H, 11S, 11H])

If there are multiple sets that can be form, return the strongest set.

Discussion (0)

Share your thoughts and ask questions

Join the Discussion

Sign in with Google to share your thoughts and ask questions

No comments yet

Be the first to share your thoughts and start the discussion!