competitive-programming
Here are some solutions to leetcode or competitive programming problems i made
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic links in README
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (0.4%) to scientific vocabulary
Last synced: 6 months ago
·
JSON representation
·
Repository
Here are some solutions to leetcode or competitive programming problems i made
Basic Info
- Host: GitHub
- Owner: Anubis-1001
- Language: Python
- Default Branch: main
- Size: 339 KB
Statistics
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
- Releases: 0
Created 9 months ago
· Last pushed 9 months ago
Metadata Files
Citation
Owner
- Name: Anubis Correa Urbano
- Login: Anubis-1001
- Kind: user
- Repositories: 2
- Profile: https://github.com/Anubis-1001
Citation (citations)
def longestPath(parent, s):
childs=[ [] for _ in parent ]
for i in range(len(parent)):
if i != 0: childs[parent[i]].append(i)
def dfs(i):
longest=0
maximum=float("-inf")
for x in childs[i]:
if s[i] != s[x]:
r=dfs(x)
longest+=r[0]
else:
r=dfs(x)
maximum=max(maximum, r[1])
maximum=max(maximum, longest+1)
return longest+1, maximum
return dfs(0)
print(longestPath([-1,0,0,1,1,2], "abacbe"))
print(longestPath([-1,0,0,0], "aabc"))
print(longestPath([-1,0,1], "aab"))
print(longestPath([-1,0,1], "aab"))
print(longestPath([-1,137,65,60,73,138,81,17,45,163,145,99,29,162,19,20,132,132,13,60,21,18,155,65,13,163,125,102,96,60,50,101,100,86,162,42,162,94,21,56,45,56,13,23,101,76,57,89,4,161,16,139,29,60,44,127,19,68,71,55,13,36,148,129,75,41,107,91,52,42,93,85,125,89,132,13,141,21,152,21,79,160,130,103,46,65,71,33,129,0,19,148,65,125,41,38,104,115,130,164,138,108,65,31,13,60,29,116,26,58,118,10,138,14,28,91,60,47,2,149,99,28,154,71,96,60,106,79,129,83,42,102,34,41,55,31,154,26,34,127,42,133,113,125,113,13,54,132,13,56,13,42,102,135,130,75,25,80,159,39,29,41,89,85,19] , "ajunvefrdrpgxltugqqrwisyfwwtldxjgaxsbbkhvuqeoigqssefoyngykgtthpzvsxgxrqedntvsjcpdnupvqtroxmbpsdwoswxfarnixkvcimzgvrevxnxtkkovwxcjmtgqrrsqyshxbfxptuvqrytctujnzzydhpal"))
GitHub Events
Total
- Push event: 1
Last Year
- Push event: 1