LinkedIn | Phone screen | Staff Software Engineer

Anonymous User
1368
May 20, 2024
May 20, 2024

Few behavioral questions. Like: tell me about time when you led technical initiative, tell me how you can you remove yourself as a lead from a critical path.

Code question:

// Implement the following interface.
// All methods must run in O(1) time.
// class AllForOneStore:

// Increment the provided key's frequency value by 1. Or add the key with the frequency 1 if it's not present.
// Note: the actual frequency value of the key is not necessary to expose to the caller; its value is only kept internally for bookkeeping purposes.
// def incrementKey(key: string) -> None

// Decrement the provided key's frequency value by 1. Or remove the key if its frequency is 1. Do nothing if the key is not present.
// Note: that the actual frequency value of the key is not necessary to expose to the caller; its value is only kept internally for bookkeeping purposes.
// def decrementKey(key: string) -> None

// Get one of the keys with the max frequency, or empty string if there are no keys.
// def getMaxKey() -> str

// Get one of the keys with the min frequency, or empty string if there are no keys.
// def getMinKey() -> str

// Example sequence
// incrementKey("foo"); // void
// incrementKey("foo"); // void
// incrementKey("foo"); // void
// incrementKey("foo"); // void
// incrementKey("bar"); // void
// incrementKey("bar"); // void
// incrementKey("bar"); // void
// incrementKey("bar"); // void
// getMaxKey(); // "foo" or "bar" can be returned because foo -> 4, and bar -> 4
// getMinKey(); // "foo" or "bar" can be returned because foo -> 4, and bar -> 4
// decrementKey("foo"); // void
// getMaxKey(); // "bar" because foo -> 3, and bar -> 4
// decrementKey("foo"); // void
// getMinKey(); // "foo" because foo -> 2, and bar -> 4
// decrementKey("foo"); // void
// getMaxKey(); // "bar" because foo is not in the structure, and bar -> 4
// decrementKey("foo"); // will fail because foo is not in the structure, and bar -> 4
// getMinKey(); // "bar" because foo is not in the structure, and bar -> 4

Got rejected. Was not able finish on time this coding question.

Comments (4)