141-Linked List Cycle Given head, the head of a linked list, determine if the linked list has a cycle in it. There is a cycle in a linked list if there is some node in the list that can be reached...
Leetcode 110 Balanced Binary Tree
110-Balanced Binary Tree Given a binary tree, determine if it is height-balanced. Height-Balanced A height-balanced binary tree is a binary tree in which the depth of the two subtrees of every nod...
Leetcode 235 Lowest Common Ancestor of a Binary Search Tree
235-Lowest Common Ancestor of a Binary Search Tree Given a binary search tree (BST), find the lowest common ancestor (LCA) node of two given nodes in the BST. According to the definition of LCA on...
Leetcode 121 Best Time to Buy and Sell Stock
Best Time to Buy and Sell Stock problem results Best Time to Buy and Sell Stock First Blood { class Solution { public: int maxProfit(vector<int>& prices) { int lessest...
Leetcode 409 Longest Palindrome
Longest Palindrome problem results Longest Palindrome Given a string s which consists of lowercase or uppercase letters, return the length of the longest palindrome that can be built with those le...
Leetcode 589 N-ary Tree Preorder Traversal
N-ary Tree Preorder Traversal problem results N-ary Tree Preorder Traversal Given the root of an n-ary tree, return the preorder traversal of its nodes’ values. Nary-Tree input serialization is r...
Leetcode 704 Binary Search
Binary Search problem results Binary Search Given an array of integer nums which is sorted in ascending order, and an integer target, write a function to search target in nums. If the target exist...
Leetcode 102 Binary Tree Level Order Traversal
Binary Tree Level Order Traversal problem results Binary Tree Level Order Traversal First Blood { /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeN...
Leetcode 98 Validate Binary Search Tree
Validate Binary Search Tree problem results Validate Binary Search Tree First Blood { /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; ...
Leetcode 278 First Bad Version
First Bad Version problem results First Bad Version First Blood { // The API isBadVersion is defined for you. // bool isBadVersion(int version); class Solution { public: int firstBadVe...