Zscaler Interview Questions
Showing 25 questions
You're given an array of numbers and a target value 'k'. You can apply specific operations to array elements to maximize the array's sum; determine the minimum number of operations needed to make the sum greater than or equal to k.
#1. Apply Operations to Make Sum of Array Greater Than or Equal to k
Find two numbers in an array that form a 'strong pair' (where one number is no more than twice the other). Maximize the XOR result of all possible strong pairs, and return that maximum value.
#2. Maximum Strong Pair XOR I
Rearrange the digits of a given number to form the largest possible number. You can only swap digits with the same parity (even or odd).
#3. Largest Number After Digit Swaps by Parity
Given an array of integers, find the maximum XOR value of a pair of numbers that also satisfy the condition where the smaller number is at least half of the larger number.
#4. Maximum Strong Pair XOR II
Given a date string, determine which day of the year it represents (e.g., January 1st is day 1). Calculate the day number accounting for leap years.
#5. Day of the Year
You are given a list of transactions between people. Determine the minimum number of transactions needed to settle all debts, such that everyone owes or is owed exactly zero.
#6. Optimal Account Balancing
You are given an array of integers. Determine the minimum number of operations needed to sort the array in non-decreasing order, where each operation involves replacing an element with one or more elements that sum to the original value.
#7. Minimum Replacements to Sort the Array
You are given a square matrix representing an image. Rotate the image by 90 degrees clockwise in-place.
#8. Rotate Image
You are given an array where each element represents your maximum jump length at that position. Determine if you can reach the last index starting from the first index.
#9. Jump Game
Given an array of numbers and a threshold, find the smallest divisor that ensures the sum of the divisions (ceiling) is less than or equal to the threshold. You need to efficiently search for this divisor.
#10. Find the Smallest Divisor Given a Threshold
Find the longest string that is a prefix of all strings in a given array. If no common prefix exists, return an empty string.
#11. Longest Common Prefix
You're given a sorted array that has been rotated, and a target value. Find the index of the target value in the rotated array, or return -1 if it's not present.
#12. Search in Rotated Sorted Array
Design a data structure to calculate the moving average of a stream of numbers. The moving average is calculated over a sliding window of a specified size.
#13. Moving Average from Data Stream
Design a data structure that acts as a Least Recently Used (LRU) cache. Implement methods to get and put key-value pairs, evicting the least recently used entry when the cache is full.
#14. LRU Cache
Transform one word into another, one letter at a time, using only words from a given dictionary. Find the shortest sequence of words to reach the target.
#15. Word Ladder
Find the smallest subarray within a given array that has the same degree as the entire array. The degree is defined as the highest frequency of any element.
#16. Degree of an Array
A robot follows a sequence of instructions (move and rotate). Determine if the robot ends up back at its starting point, or if it's trapped in a repeating circular path.
#17. Robot Bounded In Circle
Given an array of integers, determine how many triplets sum up to a multiple of a given number. Count the number of such divisible triplets.
#18. Number of Divisible Triplet Sums
You're given an array of numbers. Find the minimum number of increments needed to make all the numbers in the array unique.
#19. Minimum Increment to Make Array Unique
Find the length of the longest substring within a given string that contains no repeating characters. The substring must be contiguous.
#20. Longest Substring Without Repeating Characters