# All posts tagged featured

Problem Statement Given a weighted Directed Acyclic Graphs (DAG), find the shortest path to a particular point from the given starting point. One thing you can do is apply an O(N*N) algorithm and find the shortest distance by calculating all the distances from each node to every other node. As . . . Read more

Problem Statement Given the following input CSV file: From To Rate USD;EUR;0.89 USD;GBP;0.79 GBP;CHF;1.26 CHF;JPY;108.66 … … … Implement an algorithm to convert from a source currency to a target currency. package problems; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.util.*; /** * Given the following input CSV file: * * From . . . Read more

Problem Statement In this challenge, you will be given an array of integers, each unique within the array, and an integer representing a target difference. Determine the number of pairs of elements in the array that have a difference equal to the target difference. For example, consider the array [1, . . . Read more

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

Problem statement Given a set of distinct integers, , return all possible subsets. Note: The solution set must not contain duplicate subsets. Sample input [1, 2, 3] Sample output [[], [3], [2], [2, 3], [1], [1, 3], [1, 2], [1, 2, 3]] Full code class Solution(object): def subsets(self, nums): “”” . . . Read more