JAVA(2017)
-
653. Two Sum IV – Input is a BST
Given a Binary Search Tree and a target number, return true if there exist two elements in the BST s…
-
112. Path Sum
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all…
-
110. Balanced Binary Tree
Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary …
-
270. Closest Binary Search Tree Value
Given a non-empty binary search tree and a target value, find the value in the BST that is closest t…
-
100. Same Tree
Given two binary trees, write a function to check if they are equal or not. Two binary trees are con…
-
107. Binary Tree Level Order Traversal II
Given a binary tree, return the bottom-up level order traversal of its nodes’ values. (ie, fro…
-
257. Binary Tree Paths
Given a binary tree, return all root-to-leaf paths. For example, given the following binary tree: 1 …
-
400. Nth Digit
Find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, … Note:…
-
645. Set Mismatch
The set S originally contains numbers from 1 to n. But unfortunately, due to the data error, one of …
-
202. Happy Number
Write an algorithm to determine if a number is “happy”. A happy number is a number defin…
-
258. Add Digits
Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.…
-
441. Arranging Coins
You have a total of n coins that you want to form in a staircase shape, where every k-th row must ha…
-
168. Excel Sheet Column Title
Given a positive integer, return its corresponding column title as appear in an Excel sheet. For exa…
-
231. Power of Two
Given an integer, write a function to determine if it is a power of two. class Solution { public boo…
-
263. Ugly Number
Write a program to check whether a given number is an ugly number. Ugly numbers are positive numbers…