전체 글137 [Arrays] sudoku2 - Apple, Uber Problem: Sudoku is a number-placement puzzle. The objective is to fill a 9 × 9 grid with numbers in such a way that each column, each row, and each of the nine 3 × 3 sub-grids that compose the grid all contain all of the numbers from 1 to 9 one time. Implement an algorithm that will check whether the given grid of numbers represents a valid Sudoku puzzle according to the layout rules described a.. 2020. 5. 29. [Arrays] rotateImage - Amazon, Microsoft, Apple Problem: Note: Try to solve this task in-place (with O(1) additional memory), since this is what you'll be asked to do during an interview. You are given an n x n 2D matrix that represents an image. Rotate the image by 90 degrees (clockwise). Example For the output should be -Summary- 1. Reverse the matrix first 2. Transpose the matrix to move around the elements. The element will be rotated wit.. 2020. 5. 29. [Arrays] firstNotRepeatingCharacter - Amazon Problem: Given a string s consisting of small English letters, find and return the first instance of a non-repeating character in it. If there is no such character, return '_'. Example For s = "abacabad", the output should be firstNotRepeatingCharacter(s) = 'c'. There are 2 non-repeating characters in the string: 'c' and 'd'. Return c since it appears in the string first. For s = "abacabaabacaba.. 2020. 5. 29. [Arrays] firstDuplicate - Google Problem: Given an array a that contains only numbers in the range from 1 to a.length, find the first duplicate number for which the second occurrence has the minimal index. In other words, if there are more than 1 duplicated numbers, return the number for which the second occurrence has a smaller index than the second occurrence of the other number does. If there are no such elements, return -1... 2020. 5. 29. CodeSignal [60/60] sudoku Problem: Sudoku is a number-placement puzzle. The objective is to fill a 9 × 9 grid with digits so that each column, each row, and each of the nine 3 × 3 sub-grids that compose the grid contains all of the digits from 1 to 9. This algorithm should check if the given grid of numbers represents a correct solution to Sudoku. Example For the output should be sudoku(grid) = true; For the output shoul.. 2020. 5. 28. CodeSignal [59/60] spiralNumbers Problem: Construct a square matrix with a size N × N containing integers from 1 to N * N in a spiral order, starting from top-left and in clockwise direction. Example For n = 3, the output should be -Summary- 1. Create N*N matrix filled with zeros 2. Create a dx and dy position and loop through each position filled the numbers 이해가 잘 가지 않는 문제라 사람들의 discussion 과 솔루션을 참조하였다. 항상 matrix 문제가 제일 까다롭고 복.. 2020. 5. 28. 이전 1 ··· 12 13 14 15 16 17 18 ··· 23 다음