Skip to content

Instantly share code, notes, and snippets.

View Ahmah2009's full-sized avatar
:electron:
Overthinking

Ahmad M ElShareif Ahmah2009

:electron:
Overthinking
View GitHub Profile
@Ahmah2009
Ahmah2009 / findAllConcatenatedWordsInADict.go
Created April 4, 2019 06:40
472. Concatenated Words leetcode
func findAllConcatenatedWordsInADict(words []string) []string {
res:= []string{}
mp:= make(map[string]int)
for _, word := range words {
mp[word] = 1
}
for _, word := range words {
delete(mp, word)
@Ahmah2009
Ahmah2009 / deleteDuplicates.go
Created April 6, 2019 11:51
82. Remove Duplicates from Sorted List II leetcode
func deleteDuplicates(head *ListNode) *ListNode {
if head == nil{
return head
}
tempNode := &ListNode{Val: head.Val-1, Next:head}
node:=tempNode
fast := tempNode.Next
for node.Next!=nil && fast.Next!=nil{
@Ahmah2009
Ahmah2009 / deleteDuplicates.go
Created April 6, 2019 12:26
83. Remove Duplicates from Sorted List leetcode
func deleteDuplicates(head *ListNode) *ListNode {
if head == nil {
return head
}
node:=head
next := head.Next
for node!=nil && next!=nil{
if node.Val==next.Val{
temp := next
class Solution:
def climbStairs(self, n: int) -> int:
if n==0 or n==1 or n==2:
return n
m = n+1
step_n = [0] * m
step_n[0] = 0
step_n[1] = 1