Backtracking

Longest Path in 2D Array
AskAI

Given a 2D array of integers, this algorithm finds the length of the longest path of consecutive numbers that can be formed in the array. The path can start and end at any element in the array.

Find all possible combinations of k numbers that add up to a given number n
AskAI

This problem asks us to find all possible combinations of k numbers that add up to a given number n, using only numbers from 1 to 9. Each combination should be a unique set of numbers , and the solution set must not contain any duplicate combinations.

Longest Path in a 2D Array
AskAI

Given a 2D array of integers, find the longest path of consecutive integers starting from the top left corner of the array. The path can move in 4 directions: up, down, left , or right.