코딩92 [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. CodeSignal [58/60] messageFromBinaryCode Problem: You are taking part in an Escape Room challenge designed specifically for programmers. In your efforts to find a clue, you've found a binary code written on the wall behind a vase, and realized that it must be an encrypted message. After some thought, your first guess is that each consecutive 8 bits of the code stand for the character with the corresponding extended ASCII code. Assuming.. 2020. 5. 28. CodeSignal [57/60] fileNaming Problem: You are given an array of desired filenames in the order of their creation. Since two files cannot have equal names, the one which comes later will have an addition to its name in a form of (k), where k is the smallest positive integer such that the obtained name is not used yet. Return an array of names that will be given to the files. Example For names = ["doc", "doc", "image", "doc(1.. 2020. 5. 28. 이전 1 ··· 7 8 9 10 11 12 13 ··· 16 다음