본문 바로가기

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 .. 더보기
One Away Strings (Java) Write a function that takes two strings and returns true if they are one away from each other.They are one away from each other if a single operation (changing a character, deleting a character or adding a character) will change one of the strings to the other.Examples:"abcde" and "abcd" are one away (deleting a character)."a" and "a" are one away (changing the only character 'a' to the equivale.. 더보기
Day 29: Bitwise AND Task Given set . Find two integers, and (where ), from set such that the value of is the maximum possible and also less than a given integer, . In this case, represents the bitwise ANDoperator.Input FormatThe first line contains an integer, , the number of test cases. Each of the subsequent lines defines a test case as space-separated integers, and , respectively.ConstraintsOutput FormatFor each.. 더보기
Day 28: RegEx, Patterns, and Intro to Databases Task Consider a database table, Emails, which has the attributes First Name and Email ID. Given rows of data simulating the Emails table, print an alphabetically-ordered list of people whose email address ends in .Input FormatThe first line contains an integer, , total number of rows in the table. Each of the subsequent lines contains space-separated strings denoting a person's first name and em.. 더보기
Day 27: Testing Objective This challenge is very different from the others we've completed because it requires you to generate a valid test case for a problem instead of solving the problem. There is no input to read, you simply have to generate and print test values for the problem that satisfy both the problem's Input Format and the criteria laid out in the Tasksection. Check out the Tutorial tab for an instr.. 더보기
Day 26: Nested Logic Task Your local library needs your help! Given the expected and actual return dates for a library book, create a program that calculates the fine (if any). The fee structure is as follows:If the book is returned on or before the expected return date, no fine will be charged (i.e.: .If the book is returned after the expected return day but still within the same calendar month and year as the expe.. 더보기
Android: Service란 무엇인가 그리고 생명주기는? Service는 안드로이드 Application을 구성하는 4가지 컴포넌트 중에 하나이며, Background(화면뒷단)에서 동작하는 컴포넌트이다. Activity가 종료되어 있는 상태에서도 동작하기 위해서 만들어진 컴포넌트이며 mp3 플레이어 같이 화면이 종료되도 계속 재생될 때 사용이 필요하다. Service는 기본적으로 UI가 동작하는 main thread에서 동작한다. 그래서 Service 내에서 별도의 Thread를 생성해서 작업을 수행해야 한다. onStartCommand 와 onBind 로 나뉘게 된다. onStartCommand의 경우- 액티비티 같은 앱 컴포넌트가 startService()를 호출하면, 서비스는 실행되면(started), 그 서비스를 실행한 컴포넌트가 종료되도 할 일을 모.. 더보기