Recent posts

Backtracking – All Possible Permutations
AskAI Algorithms, Data Structures and Coding

This problem is about backtracking, or generating all possible permutations of a given set of distinct integers. For example, if the input is [1,2,3], then the output should be [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]].

283
Dec 13
Validity of a String
AskAI Algorithms, Data Structures and Coding

This function checks whether a given string containing only '(', ')' and '*' characters is valid. A string is considered valid if it follows the rules defined above.

234
Dec 13
Reverse Linked List
AskAI Algorithms, Data Structures and Coding

This problem deals with reversing a linked list. The input is a list of nodes, and the output should be the list of nodes in reverse order.

248
Dec 13
Maximizing Area in a Bar Graph
AskAI Algorithms, Data Structures and Coding

Given an array of n integers, where each integer represents the height of a bar in a bar graph, write a function that returns the maximum area that can be formed by choosing two bars from the array and stacking them on top of each other.

293
Dec 13
Possible subsets of a set of distinct integers
AskAI Algorithms, Data Structures and Coding

This problem asks us to return all possible subsets of a given set of distinct integers. For example, if the input is [1,2,3], then the output should be all possible subsets of those integers: [1], [1,2], [1,2,3], [1,3], [2], [2,3], and [3].

284
Dec 12
Determining if a string has all unique characters.
AskAI Algorithms, Data Structures and Coding

This problem asks us to develop an algorithm that can determine whether or not a given string has all unique characters. For example, the input string "abcdefg" would return True, while the input string "aabbcc" would return False.

257
Dec 12
Return the sum of the elements in an array.
AskAI Algorithms, Data Structures and Coding

This technical problem asks the coder to return the sum of the elements in an array. The input is an array of integers and the output should be the sum of those integers.

263
Dec 12
Find the deepest node in a binary tree.
AskAI Algorithms, Data Structures and Coding

To find the deepest node in a binary tree, we can use recursion. We can keep track of the maximum depth as we traverse the tree, and return the deepest node's value when we reach the end of the tree.

201
Dec 12