본문 바로가기

Is This a Binary Search Tree? (Java) Write a function that takes a binary tree and returns true if it is a binary search tree, and false if not.In our test code, we're going to use the following examples:head1 = 0 / \ 1 2 /\ /\ 3 4 5 6head1 is NOT a binary search tree.head2 = 3 / \ 1 4 /\ / \ 0 2 5 6head2 is NOT a binary search tree.head3 = 3 / \ 1 5 /\ / \ 0 2 4 6head3 is a binary search tree.head4 = 3 / \ 1 5 /\ 0 4head4 is NOT a.. 더보기
N-th Element of a Linked List (Java) Implement a function that finds the nth node in a linked list, counting from the end.Your function should take a linked list (its head element) and n, a positive integer as its arguments.Examples:head = 7 -> 6 -> 5 -> 4 -> 3 -> 2 -> 1 -> (null / None)The third element of head counting from the end is 3.head2 = 1 -> 2 -> 3 -> 4 -> (null / None)The fourth element of head2 counting from the end is .. 더보기
Rotating a 2D Array by 90 Degrees - In Place (Java) A 2-dimensional array is an array of arrays.Implement a function that takes a square 2D array (# columns = # rows) and rotates it by 90 degrees.Example: [[1, 2, 3], [4, 5, 6], [7, 8, 9]]->[[7, 4, 1], [8, 5, 2], [9, 6, 3]]When you are done, try implementing this function so that you can solve this problem in place. Solving it in place means that your function won't create a new array to solve thi.. 더보기
Rotating a 2D Array by 90 Degrees (Java) A 2-dimensional array is an array of arrays.Implement a function that takes a square 2D array (# columns = # rows) and rotates it by 90 degrees.Example: [[1, 2, 3], [4, 5, 6], [7, 8, 9]]->[[7, 4, 1], [8, 5, 2], [9, 6, 3]]When you are done, try implementing this function so that you can solve this problem in place. Solving it in place means that your function won't create a new array to solve thi.. 더보기
Find Where to Expand in Minesweeper (Java) Implement a function that turns revealed cells into -2 given a location the user wants to click.For simplicity, only reveal cells that have 0 in them. If the user clicks on any other type of cell (for example, -1 / bomb or 1, 2, or 3), just ignore the click and return the original field. If a user clicks 0, reveal all other 0's that are connected to it.Example 1: Given field: [[0, 0, 0, 0, 0], [.. 더보기
Assign Numbers in Minesweeper (Java) Implement a function that assigns correct numbers in a field of Minesweeper, which is represented as a 2 dimensional array.Example: The size of the field is 3x4, and there are bombs at the positions [0, 0] (row index = 0, column index = 0) and [0, 1] (row index = 0, column index = 1).Then, the resulting field should be:[[-1, -1, 1, 0], [2, 2, 1, 0], [0, 0, 0, 0]] Your function should return the .. 더보기
뭐하는 사람인지 (update: 2018.02.09) 2년차 비전공자 개발자이며 회사에서 안드로이드 개발을 맡고 있습니다. 블로그를 하는 이유는 누군가에게 양질의 정보를 잘 정리해서 알려주기 보다는 진짜 내가 보려고 끄적이는 정도로만 쓰고 있어요. (정리해서 올리기가 너무 귀찮음ㅇㅁㄹ니람) 언젠가 귀찮지 않고 설명충이 되고 싶을 때는 자세히 정리해서 올려 보겠습니다~ Technical SkillsLanguage - Java, Kotlin, Php Database- Realm, Mysql, Sqlite, MongoDB Server- Nginx, Apache Platforms- Android, Linux(Ubuntu), AWS Web-HTML, CSS ETC- Networking(HTTP & TCP/IP), Android NDK, OpenCV, Swift4(i.. 더보기