Tag Archives: data structures

C++: Max Product in a Matrix witout Backtrack

Problem

Given a matrix, find the path from top left to bottom right with the greatest product by moving only down and right.

The code is in C++.
The only moves allowed are down and right. The solution works for positive numbers.

Reference

Written with StackEdit.

Advertisements

C++: Find Longest Sequence of Numbers in An Unsorted Array

Given an unsorted array, find the length of the longest sequence of consecutive numbers in the array.

$ g++ -std=c++11 ./FindLongestSequence.cc
$ ./a.out
4

Reference

Written with StackEdit.