본문 바로가기

All Categories137

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.
CodeSignal [54/60] sumUpNumbers Problem: CodeMaster has just returned from shopping. He scanned the check of the items he bought and gave the resulting string to Ratiorg to figure out the total number of purchased items. Since Ratiorg is a bot he is definitely going to automate it, so he needs a program that sums up all the numbers which appear in the given input. Help Ratiorg by writing a function that returns the sum of numb.. 2020. 5. 28.
CodeSignal [53/60] validTime Problem: Check if the given string is a correct time representation of the 24-hour clock. Example For time = "13:58", the output should be validTime(time) = true; For time = "25:51", the output should be validTime(time) = false; For time = "02:76", the output should be validTime(time) = false. -Summary- 1. Check if 'HH' part and 'MM' part is valid (Valid only if 'HH' is between 0 to 23 and 'MM' .. 2020. 5. 28.