Google | Phone Screen | Game of Life & Wildcard Matching

Location: Mountain View
Position: Software Engineer
Status: 2+ YOE

Phone Screen 1:

  • Sort a card

    struct Card {
    	int suit; // 0 - spade, 1 - heart, 2 - club, 4 - diamond
    	int val;
    };
    
    // Sort unsorted to sorted
    // sorted = { spade 1, spade 2, spade 3, ..., heart 1, heart 2, ...., diamond 1, ..., diamond K };
    void sortCards(Card[] unsorted, Card[] sorted);

    Solution: Given Card c, 13 * c->suit + c->val - 1 is the position.

  • https://leetcode.com/problems/game-of-life

Phone Screen 2:

  • https://leetcode.com/problems/wildcard-matching

    The patterns has two special chars:
    ? -- stands for any single character
    * -- stands for any number of characters, including zero (empty string)

    Same as this except

    pattern = "a*c"
    string = "abcbc"

    should return False unlike the one above because it's a dumb matcher.

Comments (5)