Skip to content

Commit 3bece16

Browse files
author
Philip Guo
committed
updated some questions
1 parent 514748e commit 3bece16

4 files changed

Lines changed: 38 additions & 4 deletions

File tree

‎TODO‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,5 +173,14 @@ __weakref__ fields in the A and B type objects, with no useful repr for
173173
them. Do you really want those shown?
174174

175175
can you tell i've been doing crazy python oop stuff recently?
176+
177+
ps here's an even more painful instance of the bug report:
178+
179+
x=[1,2,3]
180+
wtfpwn = type('list',(list,),{})
181+
INCEPTION = [wtfpwn()]
182+
print x
183+
184+
which "list" is which???
176185
'''
177186

‎questions/remove-dups.txt‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,11 @@ result = removeDups(input)
6666
Expect:
6767
result = "abcdefg"
6868

69+
70+
Test:
71+
input = ""
72+
result = removeDups(input)
73+
74+
Expect:
75+
result = ""
76+

‎questions/reverse.txt‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,11 @@ result = reverse(input)
5656
Expect:
5757
result = ['a']
5858

59+
60+
Test:
61+
input = []
62+
result = reverse(input)
63+
64+
Expect:
65+
result = []
66+

‎questions/two-sum.txt‎

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ Two-sum
44
Question:
55

66
Write a function to return the sum of the two largest elements in the
7-
given list.
7+
given list (assuming you're given a list with at least two elements).
88

99
Hint:
10-
Think about sorting.
10+
Can you find the largest element? How about the second largest? Or
11+
think about sorting.
1112

1213
Solution:
13-
Sort the list and extract out the two largest elements, then return
14-
their sum.
14+
Scan through the list twice to find the two largest elements, then sum
15+
them (or sort and sum the two largest elements).
1516

1617
Skeleton:
1718

@@ -53,3 +54,11 @@ result = sumTwoLargest(input)
5354
Expect:
5455
result = 16
5556

57+
58+
Test:
59+
input = [1,2,5,3,5,4]
60+
result = sumTwoLargest(input)
61+
62+
Expect:
63+
result = 10
64+

0 commit comments

Comments
 (0)