Karat Interview Questions
Showing 13 questions
Given a sequence of words and a line width, format the text to fit within the specified width. You must justify the text, distributing extra spaces evenly between words.
#1. Text Justification
Determine if every row and every column in a given square matrix contains all the numbers from 1 to n, where n is the size of the matrix. Effectively, check if it's a valid Sudoku (without subgrids).
#2. Check if Every Row and Column Contains All Numbers
You're given a list of words and a string of characters. Determine which words can be fully formed using only the characters from the given string, and return the sum of their lengths.
#3. Find Words That Can Be Formed by Characters
Determine if a given word can be constructed from letters in a 2D board, where letters can be used horizontally or vertically. Each letter can only be used once in the word.
#4. Word Search
You're given employee names, key-card access times, and need to identify employees who used the same key-card three or more times within a one-hour period. Return these employees in sorted order.
#5. Alert Using Same Key-Card Three or More Times in a One Hour Period
Determine if you can construct a ransom note from the letters in a magazine. Each letter in the magazine can only be used once.
#6. Ransom Note
Determine if a given 9x9 Sudoku board is valid. Check if each row, column, and 3x3 subgrid contains the digits 1-9 without repetition.
#7. Valid Sudoku
Determine if it is possible to finish all courses given prerequisite relationships between them. Essentially, detect if a cycle exists in the course dependencies.
#8. Course Schedule
Find the area of the largest square that can be formed within a binary matrix containing only 1s and 0s, where the square's sides consist only of 1s.
#9. Maximal Square
Find two numbers in a given array that add up to a specific target value, and return their indices. Essentially, you need to efficiently locate the pair that satisfies the sum requirement.
#10. Two Sum
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.
#11. Jump Game
You are given a board of characters and a list of words. Find all the words from the list that can be formed by traversing adjacent cells on the board.
#12. Word Search II
You're given a list of courses and their prerequisites. Determine a valid order in which you can take all the courses, respecting the dependencies. If it's impossible to finish all courses, indicate that.
#13. Course Schedule II