Skip to content

Commit 961c056

Browse files
author
quietcoolwu
committed
hello
1 parent 658494d commit 961c056

File tree

2 files changed

+114
-228
lines changed

2 files changed

+114
-228
lines changed

.gitignore

Lines changed: 103 additions & 219 deletions
Original file line numberDiff line numberDiff line change
@@ -1,237 +1,121 @@
1-
#################
2-
## Eclipse
3-
#################
4-
5-
*.pydevproject
6-
.project
7-
.metadata
8-
bin/
9-
tmp/
10-
*.tmp
111
*.bak
12-
*.swp
13-
*~.nib
14-
local.properties
15-
.classpath
16-
.settings/
17-
.loadpath
18-
# External tool builders
19-
.externalToolBuilders/
20-
21-
# Locally stored "Eclipse launch configurations"
22-
*.launch
23-
24-
# CDT-specific
25-
.cproject
26-
27-
# PDT-specific
28-
.buildpath
29-
30-
31-
#################
32-
## Visual Studio
33-
#################
34-
35-
## Ignore Visual Studio temporary files, build results, and
36-
## files generated by popular Visual Studio add-ons.
37-
38-
# User-specific files
39-
*.suo
40-
*.user
41-
*.sln.docstates
42-
43-
# Build results
44-
45-
[Dd]ebug/
46-
[Rr]elease/
47-
x64/
2+
### Python template
3+
# Byte-compiled / optimized / DLL files
4+
__pycache__/
5+
*.py[cod]
6+
*$py.class
7+
8+
# C extensions
9+
*.so
10+
11+
# Distribution / packaging
12+
.Python
13+
env/
4814
build/
49-
[Bb]in/
50-
[Oo]bj/
51-
52-
# MSTest test Results
53-
[Tt]est[Rr]esult*/
54-
[Bb]uild[Ll]og.*
55-
56-
*_i.c
57-
*_p.c
58-
*.ilk
59-
*.meta
60-
*.obj
61-
*.pch
62-
*.pdb
63-
*.pgc
64-
*.pgd
65-
*.rsp
66-
*.sbr
67-
*.tlb
68-
*.tli
69-
*.tlh
70-
*.tmp
71-
*.tmp_proj
72-
*.log
73-
*.vspscc
74-
*.vssscc
75-
.builds
76-
*.pidb
77-
*.log
78-
*.scc
79-
80-
# Visual C++ cache files
81-
ipch/
82-
*.aps
83-
*.ncb
84-
*.opensdf
85-
*.sdf
86-
*.cachefile
87-
88-
# Visual Studio profiler
89-
*.psess
90-
*.vsp
91-
*.vspx
92-
93-
# Guidance Automation Toolkit
94-
*.gpState
95-
96-
# ReSharper is a .NET coding add-in
97-
_ReSharper*/
98-
*.[Rr]e[Ss]harper
99-
100-
# TeamCity is a build add-in
101-
_TeamCity*
102-
103-
# DotCover is a Code Coverage Tool
104-
*.dotCover
105-
106-
# NCrunch
107-
*.ncrunch*
108-
.*crunch*.local.xml
109-
110-
# Installshield output folder
111-
[Ee]xpress/
112-
113-
# DocProject is a documentation generator add-in
114-
DocProject/buildhelp/
115-
DocProject/Help/*.HxT
116-
DocProject/Help/*.HxC
117-
DocProject/Help/*.hhc
118-
DocProject/Help/*.hhk
119-
DocProject/Help/*.hhp
120-
DocProject/Help/Html2
121-
DocProject/Help/html
122-
123-
# Click-Once directory
124-
publish/
125-
126-
# Publish Web Output
127-
*.Publish.xml
128-
*.pubxml
129-
130-
# NuGet Packages Directory
131-
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
132-
#packages/
133-
134-
# Windows Azure Build Output
135-
csx
136-
*.build.csdef
137-
138-
# Windows Store app package directory
139-
AppPackages/
140-
141-
# Others
142-
sql/
143-
*.Cache
144-
ClientBin/
145-
[Ss]tyle[Cc]op.*
146-
~$*
147-
*~
148-
*.dbmdl
149-
*.[Pp]ublish.xml
150-
*.pfx
151-
*.publishsettings
152-
153-
# RIA/Silverlight projects
154-
Generated_Code/
155-
156-
# Backup & report files from converting an old project file to a newer
157-
# Visual Studio version. Backup files are not needed, because we have git ;-)
158-
_UpgradeReport_Files/
159-
Backup*/
160-
UpgradeLog*.XML
161-
UpgradeLog*.htm
162-
163-
# SQL Server files
164-
App_Data/*.mdf
165-
App_Data/*.ldf
166-
167-
#############
168-
## Windows detritus
169-
#############
170-
171-
# Windows image file caches
172-
Thumbs.db
173-
ehthumbs.db
174-
175-
# Folder config file
176-
Desktop.ini
177-
178-
# Recycle Bin used on file shares
179-
$RECYCLE.BIN/
180-
181-
# Mac crap
182-
.DS_Store
183-
184-
185-
#############
186-
## Python
187-
#############
188-
189-
*.py[co]
190-
191-
# Packages
192-
*.egg
193-
*.egg-info
15+
develop-eggs/
19416
dist/
195-
build/
17+
downloads/
19618
eggs/
19+
.eggs/
20+
lib/
21+
lib64/
19722
parts/
198-
var/
19923
sdist/
200-
develop-eggs/
24+
var/
25+
*.egg-info/
20126
.installed.cfg
27+
*.egg
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
20234

20335
# Installer logs
20436
pip-log.txt
37+
pip-delete-this-directory.txt
20538

20639
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
20742
.coverage
208-
.tox
43+
.coverage.*
44+
.cache
45+
nosetests.xml
46+
coverage.xml
47+
*,cover
20948

210-
#Translations
49+
# Translations
21150
*.mo
51+
*.pot
52+
53+
# Django stuff:
54+
*.log
55+
56+
# Sphinx documentation
57+
docs/_build/
58+
59+
# PyBuilder
60+
target/
61+
### JetBrains template
62+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio
21263

213-
#Mr Developer
214-
.mr.developer.cfg
215-
log/
216-
data/
217-
# python byte code
218-
*.pyc
219-
220-
#############
221-
## Sublime
222-
#############
223-
# Ignore production server environment files
224-
uwsgi_params
225-
# sublime text
226-
*.sublime-workspace
227-
228-
229-
#############
230-
## Idea
231-
#############
232-
.idea
233-
.idea/
234-
*.eml
23564
*.iml
23665

237-
doc/
66+
## Directory-based project format:
67+
.idea/
68+
# if you remove the above rule, at least ignore the following:
69+
70+
# User-specific stuff:
71+
# .idea/workspace.xml
72+
# .idea/tasks.xml
73+
# .idea/dictionaries
74+
75+
# Sensitive or high-churn files:
76+
# .idea/dataSources.ids
77+
# .idea/dataSources.xml
78+
# .idea/sqlDataSources.xml
79+
# .idea/dynamic.xml
80+
# .idea/uiDesigner.xml
81+
82+
# Gradle:
83+
# .idea/gradle.xml
84+
# .idea/libraries
85+
86+
# Mongo Explorer plugin:
87+
# .idea/mongoSettings.xml
88+
89+
## File-based project format:
90+
*.ipr
91+
*.iws
92+
93+
## Plugin-specific files:
94+
95+
# IntelliJ
96+
/out/
97+
98+
# mpeltonen/sbt-idea plugin
99+
.idea_modules/
100+
101+
# JIRA plugin
102+
atlassian-ide-plugin.xml
103+
104+
# Crashlytics plugin (for Android Studio and IntelliJ)
105+
com_crashlytics_export_strings.xml
106+
crashlytics.properties
107+
crashlytics-build.properties
108+
### Java template
109+
*.class
110+
111+
# Mobile Tools for Java (J2ME)
112+
.mtj.tmp/
113+
114+
# Package Files #
115+
*.jar
116+
*.war
117+
*.ear
118+
119+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
120+
hs_err_pid*
121+

049 Anagrams.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
Note: All inputs will be in lower-case.
55
"""
66
__author__ = 'Danyang'
7+
8+
79
class Solution:
810
def anagrams_complicated(self, strs):
911
"""
@@ -13,13 +15,12 @@ def anagrams_complicated(self, strs):
1315
"""
1416
temp = list(strs)
1517
for ind, string in enumerate(temp):
16-
if string and string!="": # avoid case of empty string
18+
if string and string != "": # avoid case of empty string
1719
string = [char for char in string]
1820
string.sort()
1921
string = "".join(string)
2022
temp[ind] = string
2123

22-
2324
hash_map = {}
2425
for ind, string in enumerate(temp):
2526
indexes = hash_map.get(string, [])
@@ -28,7 +29,7 @@ def anagrams_complicated(self, strs):
2829

2930
result = []
3031
for val in hash_map.values():
31-
if len(val)>1:
32+
if len(val) > 1:
3233
# result.append([strs[i] for i in val])
3334
result += [strs[i] for i in val]
3435
return result
@@ -46,16 +47,17 @@ def anagrams(self, strs):
4647
hash_map[string] = [ind]
4748
else:
4849
hash_map[string].append(ind)
49-
# indexes = hash_map.get(string, [])
50-
# indexes.append(ind) # side-effect
51-
# hash_map[string] = indexes # reassign
50+
# indexes = hash_map.get(string, [])
51+
# indexes.append(ind) # side-effect
52+
# hash_map[string] = indexes # reassign
5253

5354
result = []
5455
for val in hash_map.values():
55-
if len(val)>1:
56+
if len(val) > 1:
5657
# result.append([strs[i] for i in val])
5758
result += [strs[i] for i in val]
5859
return result
5960

60-
if __name__=="__main__":
61-
Solution().anagrams(["", ""])
61+
62+
if __name__ == "__main__":
63+
Solution().anagrams(["", ""])

0 commit comments

Comments
 (0)