title-img


The Accountant - Google Top Interview Questions

Spreadsheets often use this alphabetical encoding for its columns: "A", "B", "C", ..., "AA", "AB", "AC", ..., "ZZ", "AAA", "AAB", "AAC", .... Given a column number n, return its alphabetical column id. For example, given 1, return "A". Given 27, return "AA". Constraints 1 ≤ n < 2 ** 31 Example 1 Input n = 1 Output "A" Example 2 Input n = 2 Output "B" Example 3 Input n = 26 Output "Z" Example 4 Input n = 27 Output "AA"

View Solution →

Three Doubled Numbers - Google Top Interview Questions

Given a list of integers nums, return the number of triples i < j < k such that nums[i] * 2 = nums[j] and nums[j] * 2 = nums[k]. Constraints 0 ≤ n ≤ 100,000 where n is the length of nums Example 1 Input nums = [1, 0, 2, 4, 4] Output 2 Explanation There's [1, 2, 4] (with indices 0,2, and 3) and [1, 2, 4] (with indices 0, 2, 4) Example 2 Input nums = [4, 2, 1] Output 0

View Solution →

Trail to Minimize Effort - Google Top Interview Questions

You are given a two-dimensional list of integers matrix where element represents the height of a hill. You are currently on the top left cell and want to go to the bottom right cell. In each move, you can go up, down, left, or right. A path's cost is defined to the largest absolute difference of heights between any two consecutive cells in the path. Return the minimum cost of any path. Constraints 1 ≤ n, m ≤ 250 where n and m are the number of rows and columns in matrix

View Solution →

Valid State of List - Google Top Interview Questions

Given a list of integers nums, return whether every number can be grouped using one of the following rules: You can form contiguous pairs (a, a) You can form contiguous triplets (a, a, a) You can form contiguous triplets (a, a + 1, a + 2) Constraints n ≤ 100,000 where n is the length of nums. Example 1 Input nums = [7, 7, 3, 4, 5] Output True Explanation We can group [7, 7] together and [3, 4, 5] together. Example 2 Input nums = [1, 3, 2] Out

View Solution →

Virtual Boolean Array - Google Top Interview Questions

Implement a boolean array which implements the following methods: BooleanArray() which initializes an array of size 2 ** 31 with all false values. void setTrue(int i) which sets the value at index i to true. void setFalse(int i) which sets the value at index i to false. void setAllTrue() which sets the value at every index to true. void setAllFalse() which sets the value at every index to false. boolean getValue(int i) which returns the value at index i. Constraints 0

View Solution →