## Log Truncation - Google Top Interview Questions

You are given a list of integers logs and an integer limit. Each element in logs[i] represents the size of logs generated by user i. limit represents the total size of logs you can store in your system. Return the largest x such that if we truncate every log in logs to be at most size x, the sum of the remaining log sizes is at most limit. If no log needs to be truncated, return the largest log size. Constraints 1 ≤ n ≤ 100,000 where n is the length of logs 1 ≤ limit < 2 ** 3

## Longest Arithmetic Subsequence with Difference Constraint - Google Top Interview Questions

Given a list of integers nums and an integer diff, return the length of the longest arithmetic subsequence where the difference between each consecutive numbers in the subsequence is diff. Constraints 0 ≤ n ≤ 100,000 where n is the length of nums Example 1 Input nums = [-2, 0, 3, 6, 1, 9] diff = 3 Output 4 Explanation We can pick the subsequence [0, 3, 6, 9]. Example 2 Input nums = [9, 8, 7, 5, 3] diff = -2 Output 4 Explanation We can pick

## Longest Consecutive Sublist - Google Top Interview Questions

You are given a list of unique integers nums. Return the length of the longest sublist containing consecutive elements. Constraints 0 ≤ n ≤ 1,000 where n is the length of nums Example 1 Input nums = [1, 4, 5, 3, 2, 9] Output 5 Explanation The sublist [1, 4, 5, 3, 2] contains consecutive elements from 1 to 5.

## Longest Equivalent Sublist After K Increments - Google Top Interview Questions

You are given a list of integers nums and an integer k. Consider an operation where you increment any one element once. Given that you can perform this at most k times, return the length of the longest sublist containing equal elements. Constraints n ≤ 100,000 where n is the length of nums k < 2 ** 31 Example 1 Input nums = [2, 4, 8, 5, 9, 6] k = 6 Output 3 Explanation We can increment 8 once and 5 four times to get a sublist of [9, 9, 9].

## Longest Matrix Path Length - Google Top Interview Questions

You are given a two dimensional integer matrix where 0 is an empty cell and 1 is a wall. You can start at any empty cell on row 0 and want to end up on any empty cell on row n - 1. Given that you can move left, right, or down, return the longest such path where you visit each cell at most once. If there is no viable path, return 0. Constraints 1 ≤ n * m ≤ 200,000 where n and m are the number of rows and columns in matrix. Example 1 Input matrix = [ [0, 0, 0, 0],