본문 바로가기

Strings: Making Anagrams Alice is taking a cryptography class and finding anagrams to be very useful. We consider two strings to be anagrams of each other if the first string's letters can be rearranged to form the second string. In other words, both strings must contain the same exact letters in the same exact frequency For example, bacdc and dcbac are anagrams, but bacdc and dcbad are not.Alice decides on an encryptio.. 더보기
Level 1 - 행렬의 덧셈 행렬의 덧셈은 행과 열의 크기가 같은 두 행렬의 같은 행, 같은 열의 값을 서로 더한 결과가 됩니다. 2개의 행렬을 입력받는 sumMatrix 함수를 완성하여 행렬 덧셈의 결과를 반환해 주세요.예를 들어 2x2 행렬인 A = ((1, 2), (2, 3)), B = ((3, 4), (5, 6)) 가 주어지면, 같은 2x2 행렬인 ((4, 6), (7, 9))를 반환하면 됩니다.(어떠한 행렬에도 대응하는 함수를 완성해주세요.) 풀이class SumMatrix {int[][] sumMatrix(int[][] A, int[][] B) {int[][] answer = new int[A.length][A[0].length]; for (int i = 0; i < A.length; i++) { for (int j = .. 더보기
Day 1: Data Types Objective Today, we're discussing data types. Check out the Tutorial tab for learning materials and an instructional video!Task Complete the code in the editor below. The variables , , and are already declared and initialized for you. You must:Declare variables: one of type int, one of type double, and one of type String.Read lines of input from stdin (according to the sequence given in the Inpu.. 더보기
Level 1 - 약수의 합 어떤 수를 입력받아 그 수의 약수를 모두 더한 수 sumDivisor 함수를 완성해 보세요. 예를 들어 12가 입력된다면 12의 약수는 [1, 2, 3, 4, 6, 12]가 되고, 총 합은 28이 되므로 28을 반환해 주면 됩니다. 풀이 class SumDivisor {public int sumDivisor(int num) {int answer = 0; for (int i = 1; i 더보기
Common Elements in Two Sorted Arrays (Java) Common Elements in Two Sorted Arrays (Java)Write a function that returns the common elements (as an array) between two sorted arrays of integers (ascending order).Example: The common elements between [1, 3, 4, 6, 7, 9] and [1, 2, 4, 5, 9, 10] are [1, 4, 9]. 풀이ascending order임으로 중복된 숫자는 안들어감map 에 담아서 중복되는 게 있으면 list에 담아두고 이걸 나중에 array 변환 (list는 resizable하니까) import java.util.ArrayList;import java.. 더보기
Arrays: Left Rotation A left rotation operation on an array of size shifts each of the array's elements unit to the left. For example, if left rotations are performed on array , then the array would become .Given an array of integers and a number, , perform left rotations on the array. Then print the updated array as a single line of space-separated integers.Input FormatThe first line contains two space-separated int.. 더보기
Day 0: Hello, World. Objective In this challenge, we review some basic concepts that will get you started with this series. You will need to use the same (or similar) syntax to read input and write output in challenges throughout HackerRank. Check out the Tutorial tab for learning materials and an instructional video!Task To complete this challenge, you must save a line of input from stdin to a variable, print Hello.. 더보기
Introduction to Algorithms (19/103) Insertion Sort까지 완료 더보기
Introduction to Algorithms (11/103) Total 103 section 중 11 section 완료 (bubble sort) 더보기
Udemy 강의 현재 강의가 세일중이라 우선 3개만 구입했다. 파이썬으로 인터뷰 준비하는게 더 편하다는 평이 많아서 파이썬으로 구매할까 했는데... 일도 워낙 바쁜 관계로 좀 더 친숙한 자바로 하는게 나을 듯(초창기 api개발 때 장고로 같이 짰는데 지금 안드로이드만 해서...ㅠㅠ) 더보기