Х5 interview
Questions7
There is a combination lock measuring M×N outside the office entrance, consisting of buttons with numbers on them. The numbers increase from left to right and from top to bottom, starting at one. The password changes every day, and users are sent an array of numbers. Determine how many finger movements are needed to enter the entire password. The finger can move up, down, left, right, and diagonally (like a chess king). For example, for M=3, N=4 and the password [1, 9, 3, 7], 5 movements are needed.
Why do we take the maximum of the coordinate differences to find the minimum number of moves between buttons when moving like a chess king?
Given an integer array `nums`, return the length of the longest sequence of consecutive elements (the elements do not have to appear in the given order). Example 1: Input: `nums = [100,4,200,1,3,2]` Output: `4` Explanation: The longest sequence is `[1, 2, 3, 4]`, and its length is 4. Example 2: Input: `nums = [0,3,7,2,5,8,4,6,0,1]` Output: `9` Example 3: Input: `nums = [1,0,1,2]` Output: `3`
4 more questions from this interview
A subscription opens every question, and Copilot suggests answers live during your Х5 interview.
Sign in to unlockSummarized questions based on candidates' accounts. These materials do not represent the official position of the companies and do not disclose internal processes. If you believe a publication violates your rights — contact us.