본문 바로가기

CodeSignal/Arcade36

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.
CodeSignal [56/60] digitsProduct Problem: Given an integer product, find the smallest positive (i.e. greater than 0) integer the product of whose digits is equal to product. If there is no such integer, return -1 instead. Example For product = 12, the output should be digitsProduct(product) = 26; For product = 19, the output should be digitsProduct(product) = -1. -Summary- 1. we search the number from 1 to 10000. 2. change the .. 2020. 5. 28.
CodeSignal [55/60] differentSquares Problem: Given a rectangular matrix containing only digits, calculate the number of different 2 × 2 squares in it. Example For the output should be differentSquares(matrix) = 6. Here are all 6 different 2 × 2 squares: 1 2 2 2 2 1 2 2 2 2 2 2 2 2 1 2 2 2 2 3 2 3 2 1 -Summary- 1. set variable을 만들어서 matrix 의 4*4 의 각 숫자를 string으로 만들어 저장해준다. 2. 만약 똑같은 value가 이미 있다면 저장되지 않고, 똑같은 value가 없다면 새로 저장될 것이다... 2020. 5. 28.