Autodesk Interview Questions
Showing 32 questions
You are given an array of numbers and a pattern array. Your task is to count how many subarrays within the number array match the specified pattern.
#1. Number of Subarrays That Match a Pattern I
Given a string, determine how many times the case (upper vs. lower) of consecutive letters changes. Count the number of case changes in the string.
#2. Number of Changing Keys
You are given an array of integers and a pattern. Find the number of subarrays in the array that match the given pattern of increasing, decreasing, or equal-valued elements.
#3. Number of Subarrays That Match a Pattern II
You're given an array of numbers. Distribute each number into one of two new arrays based on a simple comparison rule involving the last elements of the target arrays.
#4. Distribute Elements Into Two Arrays I
Given a list of strings, count the number of pairs where one string is both a prefix and a suffix of the other.
#5. Count Prefix and Suffix Pairs I
You are given a list of strings. Count how many pairs of strings exist in the list where one string is both a prefix and a suffix of the other string.
#6. Count Prefix and Suffix Pairs II
Given an array of integers, distribute its elements into two new arrays based on a specific rule: compare the number of elements greater than the current element in each new array, and append to the one with the higher count. Return the final concatenated array.
#7. Distribute Elements Into Two Arrays II
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.
#8. Search in Rotated Sorted Array
Find the maximum value within each sliding window of a given size as it moves across an array.
#9. Sliding Window Maximum
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.
#10. LRU Cache
Find the median of two sorted arrays. The arrays can be of different sizes, and you should aim for an efficient solution.
#11. Median of Two Sorted Arrays
Given a list of words, group together all the anagrams. Anagrams are words that contain the same letters rearranged.
#12. Group Anagrams
Determine if a string containing parentheses is valid. A valid string has matching and properly nested opening and closing parentheses.
#13. Valid Parentheses
Find all unique combinations of numbers from a given array that sum up to a specific target value. You can use the same number multiple times.
#14. Combination Sum
Find the contiguous subarray within a given array of numbers which has the largest sum. Return the sum of this subarray.
#15. Maximum Subarray
Given a string of digits, return all possible letter combinations that the number could represent, using the typical phone keypad mapping. The goal is to generate all valid combinations in any order.
#16. Letter Combinations of a Phone Number
Reverse a linked list in groups of k nodes. If the number of nodes is not a multiple of k, leave the remaining nodes at the end as is.
#17. Reverse Nodes in k-Group
Imagine a game where you repeatedly eliminate numbers from a sorted list. The goal is to determine the last remaining number after this elimination process.
#18. Elimination Game
Given a string of digits, find all possible valid IP address combinations you can create by inserting dots. An IP address is valid if each segment is between 0 and 255.
#19. Restore IP Addresses
Find the element that appears more than n/2 times in a given array of size n. Essentially, you need to identify the majority element.
#20. Majority Element