Looking for good programming challenges?

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

Archive for July 2018

Calculate the number of ways of representing n cents

Problem Statement Given an infinite number of quarters (25 cents), dimes (10 cents), nickels (5 cents) and pennies (1 cent), write code to calculate the number of ways of representing n cents Solution This is a recursive problem, so let’s figure out how to do makeChange(n) using prior solutions (i . . . Read more

Implement an algorithm to print all valid (e g , properly opened and closed) combinations of n-pairs of parentheses

Problem Statement Implement an algorithm to print all valid (e g , properly opened and closed) combinations of n-pairs of parentheses Example Input: 3 (e g , 3 pairs of parentheses) Output: ()()(), ()(()), (())(), ((())) Solution

Write a method to set all bits between i and j in N equal to M

Problem statement You are given two 32-bit numbers, and , and two bit positions, and . Write a method to set all bits between and in equal to (e g , becomes a substring of located at and starting at ) Example Input: , , , Output: Solution