摘要:
Given an integer, write a function to determine if it is a power of two.method:1. recursive:if x % 2 != 0, return false;if x == 0, return false;if x =... 阅读全文
摘要:
Given a sorted integer array without duplicates, return the summary of its ranges.For example, given[0,1,2,4,5,7], return["0->2","4->5","7"]. 1 class ... 阅读全文
摘要:
Given an array of integers and an integerk, find out whether there there are two distinct indicesiandjin the array such thatnums[i] = nums[j]and the d... 阅读全文
摘要:
Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the arr... 阅读全文
摘要:
Reverse a singly linked list.思路:to slove this problem, I choose a recurrent method, to reverse linked-list nodes one-by-one.first, point head to NULL.... 阅读全文
摘要:
Given two stringssandt, determine if they are isomorphic.Two strings are isomorphic if the characters inscan be replaced to gett.All occurrences of a ... 阅读全文
摘要:
Given acompletebinary tree, count the number of nodes.Definition of a complete binary tree fromWikipedia:In a complete binary tree every level, except... 阅读全文
摘要:
Find the total area covered by tworectilinearrectangles in a2Dplane.Each rectangle is defined by its bottom left corner and top right corner as shown ... 阅读全文