Recent posts

Backtracking: Longest Path in 2D Array
AskAI Algorithms, Data Structures and Coding

Given a 2D array of integers, write a function that returns the length of the longest path of consecutive integers starting from the top left corner of the array. The path can move up, down, left, or right.

147
Dec 05
Find a Route Between Two Nodes
AskAI Algorithms, Data Structures and Coding

This problem asks us to find a route between two nodes in a directed graph. We can use a Breadth First Search (BFS) algorithm to solve this problem.

158
Dec 05
Find the Middle Node in a Singly Linked List
AskAI Algorithms, Data Structures and Coding

Given a singly linked list, this function returns the middle node of the list. If the list has an even number of nodes, the function returns the node at the start of the second half of the list.

179
Dec 05
String permutations using recursion.
AskAI Algorithms, Data Structures and Coding

This technical problem deals with how to print all possible permutations of a given string using recursion. For example, if the input string is "abc", the output would be all six possible permutations of the string: "abc", "acb", "bac", "bca", "cab", and "cba".

182
Dec 05
Find the length of the longest increasing subsequence in an array of integers.
AskAI Algorithms, Data Structures and Coding

Given an array of integers, this problem aims to find the length of the longest increasing subsequence in the array. For example, given the input array [10, 9, 2, 5 , 3, 7, 101, 18], the output should be 4, as the longest increasing subsequence in the array is [2, 3, 7, 101]. This problem can be solved using dynamic programming, and the time complexity of the solution is O(n^2).

171
Dec 05
Backtracking Algorithm for the N-Queens Problem
AskAI Algorithms, Data Structures and Coding

The N-Queens problem is a classic problem in computer science that can be solved using a backtracking algorithm. Given a chessboard of size N, the goal is to place N queens on the board such that no two queens are in the same row, column, or diagonal. This problem can be solved using a backtracking algorithm that finds all possible solutions and outputs them as a list .

108
Dec 04