Posts by Category

Algorithm

[Lucky Algorithm] Equalize the Array (72/77)

less than 1 minute read

Equalize the Array (Hacker Rank) Karl has an array of integers. He wants to reduce the array until all remaining elements are equal. Determine the fewest num...

[Lucky Algorithm] Encryption (71/77)

less than 1 minute read

Encryption (Hacker Rank) An English text needs to be encrypted using the following encryption scheme. First, the spaces are removed from the text. Let be th...

[Lucky Algorithm] Angry Professor (69/77)

less than 1 minute read

Angry Professor (Hacker Rank) A Discrete Mathematics professor has a class of students. Frustrated with their lack of discipline, he decides to cancel class ...

[Lucky Algorithm] TArmy Game (65/77)

less than 1 minute read

Army Game (Hacker Rank) Luke is daydreaming in Math class. He has a sheet of graph paper with rows and columns, and he imagines that there is an army base i...

[Lucky Algorithm] Utopian Tree (64/77)

less than 1 minute read

Utopian Tree (Hacker Rank) The Utopian Tree goes through 2 cycles of growth every year. Each spring, it doubles in height. Each summer, its height increases ...

[Lucky Algorithm] Maximizing XOR (63/77)

less than 1 minute read

Maximizing XOR (Hacker Rank) Given two integers, and , find the maximal value of xor , written , where and satisfy the following condition:

[Lucky Algorithm] Max Min (62/77)

less than 1 minute read

Max Min (Hacker Rank) You will be given a list of integers, , and a single integer . You must create an array of length from elements of such that its unfa...

[Lucky Algorithm] Cavity Map (61/77)

1 minute read

Cavity Map (Hacker Rank) You are given a square map as a matrix of integer strings. Each cell of the map has a value denoting its depth. We will call a cell ...

[Lucky Algorithm] Lonely Integer (55/77)

less than 1 minute read

Lonely Integer (Hacker Rank) Consider an array of integers, , where all but one of the integers occur in pairs. In other words, every element in occurs exa...

[Lucky Algorithm] Marc’s Cakewalk (54/77)

less than 1 minute read

Marc’s Cakewalk (Hacker Rank) Marc loves cupcakes, but he also likes to stay fit. He eats cupcakes in one sitting, and each cupcake has a calorie count, . ...

[Lucky Algorithm] Ice Cream Parlor (51/77)

1 minute read

Ice Cream Parlor (Hacker Rank) Each time Sunny and Johnny take a trip to the Ice Cream Parlor, they pool together dollars for ice cream. On any given day, t...

[Lucky Algorithm] Picking Numbers (48/77)

less than 1 minute read

Picking Numbers (Hacker Rank) Given an array of integers, find and print the maximum number of integers you can select from the array such that the absolute ...

[Lucky Algorithm] Jim and the Orders (47/77)

less than 1 minute read

Jim and the Orders (Hacker Rank) Jim’s Burgers has hungry burger fans waiting in line. Each unique order, , is placed by a customer at time , and the order ...

[Lucky Algorithm] Missing Numbers (46/77)

less than 1 minute read

Missing Numbers (Hacker Rank) Numeros, the Artist, had two lists and , such that was a permutation of . Numeros was very proud of these lists. Unfortunatel...

[Codility Lessons] Flags(30/n)

less than 1 minute read

[Lesson10] Prime and composite numbers Flags : Find the maximum number of flags that can be set on mountain peaks.

[Codility Lessons] StoneWall(18/n)

less than 1 minute read

[Lesson7] Stacks and Queues StoneWall : Cover “Manhattan skyline” using the minimum number of rectangles Java Solution Link : https://codility.com/demo/res...

[Codility Lessons] Triangle(16/n)

less than 1 minute read

[Lesson6] Sorting Triangle : Determine whether a triangle can be built from a given set of edges. Java Solution

[Codility Lessons] Distinct(15/n)

less than 1 minute read

[Lesson6] Sorting Distinct : Compute number of distinct values in an array. Java Solution ``` import java.util.*;

[Codility Lessons] MinAvgTwoSlice(13/n)

less than 1 minute read

[Lesson5] Prefix Sums MinAvgTwoSlice : Find the minimal average of any slice containing at least two elements. Java Solution Task Score : 80 Correctness : ...

[Codility Lessons] PassingCars(12/n)

less than 1 minute read

[Lesson5] Prefix Sums PassingCars : Count the number of passing cars on the road. Java Solution Task Score : 90 Correctness : 100 Performance : 80 class S...

[Codility Lessons] MissingInteger(10/n)

1 minute read

[Lesson4] Counting Elements MaxCounters : Calculate the values of counters after applying all alternating operations: increase counter by 1; set value of all...

[Lucky Algorithm] Closest Number(43/77)

1 minute read

Closest Number (Hacker Rank) Sorting is often useful as the first step in many different tasks. The most common task is to make finding things easier, but th...

[Lucky Algorithm] Counting Sort 2(41/77)

1 minute read

Counting Sort 2 (Hacker Rank) Often, when a list is sorted, the elements being sorted are just keys to other values. For example, if you are sorting files by...

[Lucky Algorithm] Counting Sort 1(40/77)

1 minute read

Counting Sort 1 (Hacker Rank) Comparison Sorting Quicksort usually has a running time of , but is there an algorithm that can sort even faster? In general, t...

[Lucky Algorithm] The Power Sum(34/77)

less than 1 minute read

The Power Sum (Hacker Rank) Find the number of ways that a given integer, , can be expressed as the sum of the power of unique, natural numbers.

[Lucky Algorithm] Game of Stones(32/77)

less than 1 minute read

Game of Stones (Hacker Rank) Two players (numbered and ) are playing a game with stones. Player always plays first, and the two players move in alternatin...

[Lucky Algorithm] Pangrams(31/77)

less than 1 minute read

Pangrams (Hacker Rank) Roy wanted to increase his typing speed for programming contests. So, his friend advised him to type the sentence “The quick brown fox...

[Lucky Algorithm] Mars Exploration(29/77)

less than 1 minute read

Mars Exploration (Hacker Rank) Letters in some of the SOS messages are altered by cosmic radiation during transmission. Given the signal received by Earth as...

[Lucky Algorithm] CamelCase(28/77)

less than 1 minute read

CamelCase (Hacker Rank) Alice wrote a sequence of words in CamelCase as a string of letters, , having the following properties:

[Lucky Algorithm] Super Reduced String(27/77)

less than 1 minute read

Super Reduced String (Hacker Rank) Steve has a string, , consisting of lowercase English alphabetic letters. In one operation, he can delete any pair of adj...

[Lucky Algorithm] Find Digits(26/77)

less than 1 minute read

Find Digits (Hacker Rank) Given an integer, , traverse its digits (1,2,…,n) and determine how many digits evenly divide (i.e.: count the number of times di...

[Lucky Algorithm] The Hurdle Race(25/77)

less than 1 minute read

The Hurdle Race (Hacker Rank) Dan is playing a video game in which his character competes in a hurdle race by jumping over hurdles with heights . He can ini...

[Lucky Algorithm] Cats and a Mouse(24/77)

1 minute read

Cats and a Mouse (Hacker Rank) Two cats named and are standing at integral points on the x-axis. Cat is standing at point and cat is standing at point ....

[Lucky Algorithm] Electronics Shop (23/77)

1 minute read

Electronics Shop (Hacker Rank) Monica wants to buy exactly one keyboard and one USB drive from her favorite electronics store. The store sells different bra...

[Lucky Algorithm] Counting Valleys (22/77)

1 minute read

Counting Valleys (Hacker Rank) Gary is an avid hiker. He tracks his hikes meticulously, paying close attention to small details like topography. During his l...

[Lucky Algorithm] Drawing Book (21/77)

1 minute read

Drawing Book (Hacker Rank) Brie’s Drawing teacher asks her class to open their -page book to page number . Brie can either start turning pages from the front...

[Lucky Algorithm] Sock Merchant (19/77)

1 minute read

Sock Merchant (Hacker Rank) John’s clothing store has a pile of loose socks where each sock is labeled with an integer, , denoting its color. He wants to s...

[Lucky Algorithm] Bon Appétit (18/77)

1 minute read

Bon Appétit (Hacker Rank) Anna and Brian order items at a restaurant, but Anna declines to eat any of the item (where ) due to an allergy. When the check c...

[Lucky Algorithm] Migratory Birds (17/77)

1 minute read

Migratory Birds (Hacker Rank) A flock of birds is flying across the continent. Each bird has a type, and the different types are designated by the ID number...

[Lucky Algorithm] Between Two Sets (12/77)

1 minute read

Between Two Sets (Hacker Rank) Consider two sets of positive integers, and . We say that a positive integer, , is between sets and if the following condit...

[Lucky Algorithm] Kangaroo (11/77)

less than 1 minute read

Kangaroo (Hacker Rank) There are two kangaroos on a number line ready to jump in the positive direction (i.e, toward positive infinity). The first kangaroo s...

[Lucky Algorithm] Mini-Max Sum (6/77)

less than 1 minute read

Mini-Max Sum (Hacker Rank) Given five positive integers, find the minimum and maximum values that can be calculated by summing exactly four of the five integ...

[Lucky Algorithm] Staircase (5/77)

less than 1 minute read

Staircase (Hacker Rank) Consider a staircase of size : # ## ### #### Observe that its base and height are both equal to , and the image is dr...

[Lucky Algorithm] Plus Minus (4/77)

1 minute read

Plus Minus (Hacker Rank) Given an array of integers, calculate which fraction of its elements are positive, which fraction of its elements are negative, and ...

Back to top ↑

혼공머신

Back to top ↑

study

Back to top ↑

Domain Driven Design

Back to top ↑