[Easy] Parenthesis Checker

Given an expression string exp, examine whether the pairs and the orders of “{“,”}”,”(“,”)”,”[“,”]” are correct in exp. For example, the program should print ‘balanced’ for exp = “[()]{}{[()()]()} and not balanced for exp = [(])

More …

[Queue] Array를 이용한 큐 구현

스택처럼 큐는 특정한 순서로 동적하는 선형 자료구조이다. 순서는 FIFO(First In First Out). 가장 좋은 예는 마트에서 고객들이 줄을 선 순서대로 계산을 하고 나가는 것이다. 스택과 다른 점은 제거될 때이다. 스택에서는 가장 최근에 추가된 아이템이 제거되지만 큐에서는 가장 오래된 아이템이 먼저 제거된다.

More …

[Stack] Array를 이용한 스택 구현

Stack은 특정한 순서로 수행되는 선형 자료구조이다. 그 순서란 LIFO(Last In First Out) 또는 FILO(First In Last Out)을 말한다. 즉, 스티커 메모지를 겹쳐서 위로 덧붙였을 때 맨 위쪽부터 다시 하나씩 떼어지는 과정을 생각하면 된다.

More …

[Easy] Greater on right side

Given an array of integers, replace every element with the next greatest element (greatest element on the right side) in the array. Since there is no element next to the last element, replace it with -1.

More …

[Easy] Convert array into Zig-ag fashion

Given an array of distinct elements, rearrange the elements of array in zig-zag fashion in O(n) time. The converted array should be in form a < b > c < d > e < f.The relative order of elements is same in the output i.e you have to iterate on the original array only.

More …

[Easy] Maximum Difference

Given an array C[] of integers, find out the maximum difference between any two elements such that larger element appears after the smaller number in C[].
Examples: If array is [2, 3, 10, 6, 4, 8, 1] then returned value should be 8 (Diff between 10 and 2). If array is [ 7, 9, 5, 6, 3, 2 ] then returned value should be 2 (Diff between 7 and 9).

More …

[Stage 31] Deposit Profit

You have deposited a specific amount of dollars into your bank account. Each year your balance increases at the same growth rate. Find out how long it would take for your balance to pass a specific threshold with the assumption that you don’t make any additional deposits.

More …

[Stage 30] Circle of Numbers

Consider integer numbers from 0 to n - 1 written down along the circle in such a way that the distance between any two neighbouring numbers is equal (note that 0 and n - 1 are neighbouring, too).

More …