Skip to content

Commit

Permalink
update at 2019-06-15
Browse files Browse the repository at this point in the history
  • Loading branch information
rzhangpku committed Jun 15, 2019
1 parent f6a59cd commit 14176f1
Show file tree
Hide file tree
Showing 8 changed files with 118 additions and 62 deletions.
114 changes: 84 additions & 30 deletions README.md

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion req.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
certifi==2018.1.18
chardet==3.0.4
cssselect==1.0.3
idna==2.6
Expand Down
14 changes: 6 additions & 8 deletions solutions/001-two-sum/two-sum.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
# -*- coding:utf-8 -*-


# Given an array of integers, return indices of the two numbers such that they add up to a specific target.
# Given an array of integers, return indices of the two numbers such that they add up to a specific target.
#
# You may assume that each input would have exactly one solution, and you may not use the same element twice.
# You may assume that each input would have exactly one solution, and you may not use the same element twice.
#
# Example:
# Example:
#
#
# Given nums = [2, 7, 11, 15], target = 9,
# Given nums = [2, 7, 11, 15], target = 9,
#
# Because nums[0] + nums[1] = 2 + 7 = 9,
# return [0, 1].
# Because nums[0] + nums[1] = 2 + 7 = 9,
# return [0, 1].
#
#
#  
#


class Solution(object):
Expand Down
3 changes: 3 additions & 0 deletions solutions/058-length-of-last-word/length-of-last-word.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@
#
# Example:
#
#
# Input: "Hello World"
# Output: 5
#
#
#  
#


class Solution(object):
Expand Down
19 changes: 10 additions & 9 deletions solutions/520-detect-capital/detect-capital.py
Original file line number Diff line number Diff line change
@@ -1,37 +1,38 @@
# -*- coding:utf-8 -*-


#
# Given a word, you need to judge whether the usage of capitals in it is right or not.
#
#
#
# We define the usage of capitals in a word to be right when one of the following cases holds:
#
# All letters in this word are capitals, like "USA".
# All letters in this word are not capitals, like "leetcode".
# Only the first letter in this word is capital if it has more than one letter, like "Google".
#
# Otherwise, we define that this word doesn't use capitals in a right way.
# All letters in this word are capitals, like "USA".
# All letters in this word are not capitals, like "leetcode".
# Only the first letter in this word is capital, like "Google".
#
# Otherwise, we define that this word doesn't use capitals in a right way.
#
#  
#
# Example 1:
#
#
# Input: "USA"
# Output: True
#
#
#  
#
# Example 2:
#
#
# Input: "FlaG"
# Output: False
#
#
#  
#
# Note:
# The input will be a non-empty word consisting of uppercase and lowercase latin letters.
# Note: The input will be a non-empty word consisting of uppercase and lowercase latin letters.
#


Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
# -*- coding:utf-8 -*-


# Given a sorted array consisting of only integers where every element appears exactly twice except for one element which appears exactly once. Find this single element that appears only once.
#
# Given a sorted array consisting of only integers where every element appears twice except for one element which appears once. Find this single element that appears only once.
#
#  
#
# Example 1:
#
#
# Input: [1,1,2,3,3,4,4,8,8]
# Output: 2
#
#
#
# Example 2:
#
#
# Input: [3,3,7,7,10,11,11]
# Output: 10
#
#
#  
#
# Note:
# Your solution should run in O(log n) time and O(1) space.
#
# Note: Your solution should run in O(log n) time and O(1) space.
#


Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
# -*- coding:utf-8 -*-


# Given a non-empty special binary tree consisting of nodes with the non-negative value, where each node in this tree has exactly two or zero sub-node. If the node has two sub-nodes, then this node's value is the smaller value among its two sub-nodes. More formally, the property root.val = min(root.left.val, root.right.val) always holds.
#
# Given a non-empty special binary tree consisting of nodes with the non-negative value, where each node in this tree has exactly two or zero sub-node. If the node has two sub-nodes, then this node's value is the smaller value among its two sub-nodes.
#
#
#
# Given such a binary tree, you need to output the second minimum value in the set made of all the nodes' value in the whole tree.
#
#
# Given such a binary tree, you need to output the second minimum value in the set made of all the nodes' value in the whole tree.
#
# If no such second minimum value exists, output -1 instead.
#
#
# Example 1:
#
#
# Input:
# 2
# / \
Expand All @@ -26,9 +21,11 @@
# Explanation: The smallest value is 2, the second smallest value is 5.
#
#
#  
#
# Example 2:
#
#
# Input:
# 2
# / \
Expand All @@ -38,6 +35,8 @@
# Explanation: The smallest value is 2, but there isn't any second smallest value.
#
#
#  
#


# Definition for a binary tree node.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
# 1 <= emails[i].length <= 100
# 1 <= emails.length <= 100
# Each emails[i] contains exactly one '@' character.
# All local and domain names are non-empty.
# Local names do not start with a '+' character.
#
#
#
Expand Down

0 comments on commit 14176f1

Please sign in to comment.