代码改变世界

[LeetCode] 844. Backspace String Compare_Easy tag: Stack, Two pointers

2018-08-18 10:52 by Johnson_强生仔仔, 260 阅读, 0 推荐, 收藏, 编辑
摘要:Given two strings S and T, return if they are equal when both are typed into empty text editors. # means a backspace character. Example 1: Input: S = 阅读全文

[LeetCode] 728. Self Dividing Numbers_Easy tag: Math

2018-08-18 06:03 by Johnson_强生仔仔, 171 阅读, 0 推荐, 收藏, 编辑
摘要:A self-dividing number is a number that is divisible by every digit it contains. For example, 128 is a self-dividing number because 128 % 1 == 0, 128 阅读全文

[LeetCode] 197. Rising Temperature_Easy tag: SQL

2018-08-18 05:54 by Johnson_强生仔仔, 217 阅读, 0 推荐, 收藏, 编辑
摘要:Given a Weather table, write a SQL query to find all dates' Ids with higher temperature compared to its previous (yesterday's) dates. For example, ret 阅读全文

[LeetCode] 496. Next Greater Element I_Easy tag: Stack

2018-08-18 05:44 by Johnson_强生仔仔, 184 阅读, 0 推荐, 收藏, 编辑
摘要:You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1' 阅读全文

[LeetCode] 225. Implement Stack using Queues_Easy tag: Design

2018-08-18 05:30 by Johnson_强生仔仔, 303 阅读, 0 推荐, 收藏, 编辑
摘要:Implement the following operations of a stack using queues. push(x) -- Push element x onto stack. pop() -- Removes the element on top of the stack. to 阅读全文

[LeetCode] 532. K-diff Pairs in an Array_Easy tag: Hash Table

2018-08-17 11:44 by Johnson_强生仔仔, 224 阅读, 0 推荐, 收藏, 编辑
摘要:Given an array of integers and an integer k, you need to find the number of unique k-diff pairs in the array. Here a k-diff pair is defined as an inte 阅读全文

[LeetCode] 605. Can Place Flowers_Easy

2018-08-17 11:27 by Johnson_强生仔仔, 231 阅读, 0 推荐, 收藏, 编辑
摘要:Suppose you have a long flowerbed in which some of the plots are planted and some are not. However, flowers cannot be planted in adjacent plots - they 阅读全文

[LeetCode] 183. Customers Who Never Order_Easy tag: SQL

2018-08-17 11:09 by Johnson_强生仔仔, 184 阅读, 0 推荐, 收藏, 编辑
摘要:Suppose that a website contains two tables, the Customers table and the Orders table. Write a SQL query to find all customers who never order anything 阅读全文

[LeetCode] 821. Shortest Distance to a Character_Easy tag: BFS

2018-08-17 10:58 by Johnson_强生仔仔, 237 阅读, 0 推荐, 收藏, 编辑
摘要:Given a string S and a character C, return an array of integers representing the shortest distance from the character C in the string. Example 1: Note 阅读全文

[LeetCode] 796. Rotate String_Easy **KMP

2018-08-17 10:40 by Johnson_强生仔仔, 189 阅读, 0 推荐, 收藏, 编辑
摘要:We are given two strings, A and B. A shift on A consists of taking string A and moving the leftmost character to the rightmost position. For example, 阅读全文
上一页 1 ··· 22 23 24 25 26 27 28 29 30 ··· 39 下一页