Looking for good programming challenges?

Use the search below to find our solutions for selected questions!

Archive for May 2018

Find the second smallest integer in array

Problem statement Given an array of integers, find the second smallest integer in that array. Solution public class SecondSmallestInteger { public static int solve(int[] arr) { int smallest = Integer.MAX_VALUE; int secondSmallest = Integer.MAX_VALUE; ; for (int i = 0; i < arr.length; i++) { if (arr[i] < smallest) { . . . Read more

Count ways to reach the n stair

Problem statement There are stairs, a person standing at the bottom wants to reach the top. The person can climb either stair or stairs at a time. Count the number of ways, the person can reach the top. Solution We can solve this problem recursively. If the person were to . . . Read more