原创 1243. Number of Segments in a String

描述Count the number of segments in a string, where a segment is defined to be a contiguous sequence of non-space charact

原创 1319. Contains Duplicate II

描述Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array suc

原创 1254. Sum of Left Leaves

描述Find the sum of all left leaves in a given binary tree.您在真實的面試中是否遇到過這個題?  是樣例 3 / \ 9 20 / \ 15 7

原创 1216. Largest Palindrome Product

描述Find the largest palindrome made from the product of two n-digit numbers.Since the result could be very large, you sh

原创 1256. Nth Digit

描述Find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ...n is positive and will fit

原创 1230. Assign Cookies

描述Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most

原创 1237. Number of Boomerangs

描述Given n points in the plane that are all pairwise distinct, a "boomerang" is a tuple of points (i, j, k) such that th

原创 1253. Convert a Number to Hexadecimal

描述Given an integer, write an algorithm to convert it to hexadecimal. For negative integer, two’s complement method is u

原创 1227. Repeated Substring Pattern

描述Given a non-empty string check if it can be constructed by taking a substring of it and appending multiple copies of

原创 1314. Power of Two

描述Given an integer, write a function to determine if it is a power of two.您在真實的面試中是否遇到過這個題?  無難度題目class Solution { publ

原创 1231. Minimum Moves to Equal Array Elements

描述Given a non-empty integer array of size n, find the minimum number of moves required to make all array elements equal

原创 1320. Contains Duplicate

描述Given an array of integers, find if the array contains any duplicates. Your function should return true if any value

原创 1218. Number Complement

描述Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary rep

原创 近期寫題遇到的函數

1.ceil函數:用法:double ceil(double x)功能:返回大於或者等於指定表達式的最小整數頭文件:cmath/math.h2.stol函數:用法:long stol( const string& _Str,

原创 1225. Island Perimeter

描述You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid ce