Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Problem_1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# https://leetcode.com/problems/k-diff-pairs-in-an-array/

class Solution:
def findPairs(self, nums, k):
count_map = {}
for num in nums:
count_map[num] = count_map.get(num, 0) + 1
result = 0
for x in count_map.keys():
if k > 0 and x + k in count_map:
result += 1
if k == 0 and count_map[x] > 1:
result += 1
return result
16 changes: 16 additions & 0 deletions Problem_2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# https://leetcode.com/problems/pascals-triangle/

class Solution:
def generate(self, numRows):
result = [[1]]
for row in range(1, numRows):
temp = []
for i in range(row + 1):
if i == 0:
temp.append(result[row - 1][i])
elif i == row:
temp.append(result[row - 1][i - 1])
else:
temp.append(result[row - 1][i] + result[row - 1][i - 1])
result.append(temp)
return result
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# Competitive_Coding-3

Please submit the interview problems posted in slack channel here. The problems and statements are intentionally not shown here so that students are not able to see them in advance

K-diff Pairs in an Array
https://youtu.be/KTPnDMhWnoE

Pascal's Triangle
https://youtu.be/LZnp0rpEc1U

Contest Solutions:
https://www.thes30.com/problem/5db27d9ba368590004f8f324/solutions