-
[알고리즘/자바스크립트] 대문자 기준으로 글자 변환하기 (Convert PascalCase string into snake_case)Algorithm 2019. 4. 2. 00:21
-해당 문제는 codewars사이트의 level5 문제입니다. (1~8단계 중 8단계가 가장 쉬운 레벨)- [문제] Complete the function/method so that it takes CamelCase string and returns the string in snake_case notation. Lowercase characters can be numbers. If method gets number, it should return string. // returns test_controller toUnderscore('TestController'); // returns movies_and_books toUnderscore('MoviesAndBooks'); // returns app7_tes..
-
[알고리즘/자바스크립트]스도쿠 판별 알고리즘 (Did I Finish my Sudoku?)Algorithm 2019. 3. 2. 17:48
-해당 문제는 codewars사이트의 level5 문제입니다. (1~8단계 중 8단계가 가장 쉬운 레벨)- [문제] Write a function done_or_not/DoneOrNot passing a board (list[list_lines]) as parameter. If the board is valid return 'Finished!', otherwise return 'Try again!' Sudoku rules:Complete the Sudoku puzzle so that each and every row, column, and region contains the numbers one through nine only once. Rows: There are 9 rows in a tradition..
-
[알고리즘/자바스크립트] 두 객체를 비교하여 케이크 만들 수 있는 최대 횟수 구하기 (Pete, the baker)Algorithm 2019. 2. 24. 20:40
-해당 문제는 codewars사이트의 level5 문제입니다. (1~8단계 중 8단계가 가장 쉬운 레벨)- [문제] Pete likes to bake some cakes. He has some recipes and ingredients. Unfortunately he is not good in maths. Can you help him to find out, how many cakes he could bake considering his recipes? Write a function cakes(), which takes the recipe (object) and the available ingredients (also an object) and returns the maximum number of cak..
-
[알고리즘/자바스크립트] 배열의 특정요소만 맨 뒤로 옮기기 (Moving Zeros To The End)Algorithm 2019. 2. 24. 14:25
-해당 문제는 codewars사이트의 level5 문제입니다. (1~8단계 중 8단계가 가장 쉬운 레벨)- [문제] Write an algorithm that takes an array and moves all of the zeros to the end, preserving the order of the other elements.moveZeros([false,1,0,1,2,0,1,3,"a"]) // returns[false,1,1,2,1,3,"a",0,0] [해석] 배열에 있는 모든 0을 맨 뒤로 옮기되, 다른 요소들의 위치는 변경시키면 안된다. 레벨5 라고는 하지만 내 생각엔 레벨6~7 정도 되는 쉬운 문제인 것 같다.배열에서 0만 맨 뒤로 옮겨서 출력하는 문제! var moveZeros = func..