随笔分类 -  Easy

摘要:Given a column title as appear in an Excel sheet, return its corresponding column number. For example: A -> 1 B -> 2 C -> 3 ... Z -> 26 AA -> 27 AB -> 阅读全文
posted @ 2018-10-11 13:58 一丝清风一抹红尘 阅读(120) 评论(0) 推荐(0)
摘要:Given two arrays, write a function to compute their intersection. Example 1: Example 2: Input: nums1 = [4,9,5], nums2 = [9,4,9,8,4] Output: [9,4] Exam 阅读全文
posted @ 2018-10-11 13:40 一丝清风一抹红尘 阅读(121) 评论(0) 推荐(0)
摘要:Given a Binary Search Tree and a target number, return true if there exist two elements in the BST such that their sum is equal to the given target. E 阅读全文
posted @ 2018-10-11 12:21 一丝清风一抹红尘 阅读(94) 评论(0) 推荐(0)
摘要:Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. Example: Note: 阅读全文
posted @ 2018-10-11 11:44 一丝清风一抹红尘 阅读(108) 评论(0) 推荐(0)
摘要:Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) Yo 阅读全文
posted @ 2018-10-11 11:22 一丝清风一抹红尘 阅读(111) 评论(0) 推荐(0)
摘要:Invert a binary tree. Example: Input: Output: 阅读全文
posted @ 2018-10-10 12:29 一丝清风一抹红尘 阅读(119) 评论(0) 推荐(0)
摘要:A matrix is Toeplitz if every diagonal from top-left to bottom-right has the same element. Now given an M x N matrix, return True if and only if the m 阅读全文
posted @ 2018-10-09 21:25 一丝清风一抹红尘 阅读(153) 评论(0) 推荐(0)
摘要:Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest l 阅读全文
posted @ 2018-10-09 20:52 一丝清风一抹红尘 阅读(87) 评论(0) 推荐(0)
摘要:Consider all the leaves of a binary tree. From left to right order, the values of those leaves form a leaf value sequence. For example, in the given t 阅读全文
posted @ 2018-10-09 20:43 一丝清风一抹红尘 阅读(182) 评论(0) 推荐(0)
摘要:We are to write the letters of a given string S, from left to right into lines. Each line has maximum width 100 units, and if writing a letter would c 阅读全文
posted @ 2018-10-09 19:44 一丝清风一抹红尘 阅读(260) 评论(0) 推荐(0)
摘要:A peak element is an element that is greater than its neighbors. Given an input array nums, where nums[i] ≠ nums[i+1], find a peak element and return 阅读全文
posted @ 2018-10-09 18:10 一丝清风一抹红尘 阅读(118) 评论(0) 推荐(0)
摘要:Let's call an array A a mountain if the following properties hold: A.length >= 3 There exists some 0 < i < A.length - 1 such that A[0] < A[1] < ... A[ 阅读全文
posted @ 2018-10-09 16:33 一丝清风一抹红尘 阅读(109) 评论(0) 推荐(0)
摘要:International Morse Code defines a standard encoding where each letter is mapped to a series of dots and dashes, as follows: "a" maps to ".-", "b" map 阅读全文
posted @ 2018-10-09 12:51 一丝清风一抹红尘 阅读(113) 评论(0) 推荐(0)
摘要:Given a non-empty array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runti 阅读全文
posted @ 2018-10-08 13:27 一丝清风一抹红尘 阅读(93) 评论(0) 推荐(0)
摘要:Write a function that takes a string as input and returns the string reversed. Example 1: Input: "hello" Output: "olleh" Example 2: Input: "A man, a p 阅读全文
posted @ 2018-09-30 13:00 一丝清风一抹红尘 阅读(111) 评论(0) 推荐(0)
摘要:Write a program that outputs the string representation of numbers from 1 to n. But for multiples of three it should output “Fizz” instead of the numbe 阅读全文
posted @ 2018-09-30 11:27 一丝清风一抹红尘 阅读(114) 评论(0) 推荐(0)