Skip to content

Commit

Permalink
Merge pull request #1 from asdf2014/master
Browse files Browse the repository at this point in the history
some other
  • Loading branch information
GinRyan authored May 24, 2019
2 parents 0873662 + d73e903 commit fd9316a
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 2 deletions.
17 changes: 17 additions & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 60
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- bug
- security
# Label to use when marking an issue as stale
staleLabel: stale
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
26 changes: 26 additions & 0 deletions .pep8speaks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
scanner:
diff_only: True # If False, the entire file touched by the Pull Request is scanned for errors. If True, only the diff is scanned.
linter: pycodestyle # Other option is flake8

pycodestyle: # Same as scanner.linter value. Other option is flake8
max-line-length: 100 # Default is 79 in PEP 8
ignore: # Errors and warnings to ignore
- W504 # line break after binary operator
- E402 # module level import not at top of file
- E731 # do not assign a lambda expression, use a def
- C406 # Unnecessary list literal - rewrite as a dict literal.
- E741 # ambiguous variable name

no_blank_comment: True # If True, no comment is made on PR without any errors.
descending_issues_order: False # If True, PEP 8 issues in message will be displayed in descending order of line numbers in the file

message: # Customize the comment made by the bot
opened: # Messages when a new PR is submitted
header: "Hello @{name}! Thanks for opening this PR. "
# The keyword {name} is converted into the author's username
footer: "Do see the [Hitchhiker's guide to code style](https://goo.gl/hqbW4r)"
# The messages can be written as they would over GitHub
updated: # Messages when new commits are added to the PR
header: "Hello @{name}! Thanks for updating this PR. "
footer: "" # Why to comment the link to the style guide everytime? :)
no_errors: "There are currently no PEP 8 issues detected in this Pull Request. Cheers! :beers: "
8 changes: 8 additions & 0 deletions .whitesource
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"generalSettings": {
"shouldScanRepo": true
},
"checkRunSettings": {
"vulnerableCheckRunConclusionLevel": "failure"
}
}
21 changes: 21 additions & 0 deletions Codes/asdf2014/1_two_sum/two_sum.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# https://leetcode.com/problems/two-sum/


# 从 nums 中找到两个数,满足两数之和为 target
def two_sum(nums, target):
nums_len = len(nums)
if nums_len < 1:
return False
cache = {}
for i in range(nums_len):
n = nums[i]
if n in cache:
# 2. 当前值 n 在 Map 中找到对应的 key 则拿出对应的 value,因为此时 n + key 刚好等于 target
return [cache[n], i]
else:
# 1. 当前值 n 与目标值 target 的差值作为 Map 的 key,而下标作为 value
cache[target - n] = i


assert two_sum([2, 7, 11, 15], 9) == [0, 1]
assert two_sum([4, 7, 0, 3], 3) == [2, 3]
2 changes: 2 additions & 0 deletions Codes/mggger/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# 关于
leetcode刷题活动
23 changes: 23 additions & 0 deletions Codes/mggger/leetcode/1_two_sum.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# code

``` python
class Solution(object):
def twoSum(self, nums, target):
d = {}
for i, n in enumerate(nums):
m = target - n
if m in d:
return [d[m], i]
else:
d[n] = i
```

## Testcase
```python

s = Solution()
nums = [2,7,11,15]
target = 9

assert s.twoSum(nums, target) == [0, 1]
```
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
[<img align="right" width="30%" height="30%" src="https://picture.yuzhouwan.com/yuzhouwan_logo_with_copyright.jpg">](https://yuzhouwan.com/)

[![](http://progressed.io/bar/7?scale=7&title=person&suffix=位)](https://yuzhouwan.com/posts/666/)
[![](http://progressed.io/bar/1?scale=38&title=covered&suffix=个)](https://yuzhouwan.com/posts/666/)
[![](http://progressed.io/bar/1?scale=1040&title=completed&suffix=题)](https://yuzhouwan.com/posts/666/)
[![](https://img.shields.io/badge/QQ%E7%BE%A4-128708857-blue.svg)](https://shang.qq.com/wpa/qunwpa?idkey=0692372b7f92845e80bc2e3e13dd4ae0bc4c0fcf88ef5864d279b21fb1317290)


# Leetcode 组队刷题

## 介绍
Expand All @@ -9,12 +17,12 @@

### 报名途径

 只需要在《[Algorithm](https://yuzhouwan.com/posts/666/)》文末留言,即可随时上车~~
 只需要在《[Algorithm](https://yuzhouwan.com/posts/666/)》文末留言,即可随时参与


### 参与方式

 每位参与的小伙伴,都会获得代码仓库的 Collaborators 权限,可以自由地提交代码。在 `/Codes/${User}` 目录下,每人都将拥有一个自己的代码库
 每位参与的小伙伴,都会获得代码仓库的 Collaborators 权限,可以自由地提交代码。在 `/Codes/${User}` 目录下,每人都将拥有一个自己的代码库。留下 Github 名称后,将很快会收到邀请函,大家可以在 [asdf2014 - algorithm - invitations](https://github.com/asdf2014/algorithm/invitations) 链接中认领


### 刷题频率
Expand Down

0 comments on commit fd9316a

Please sign in to comment.