Skip to content

Instantly share code, notes, and snippets.

View SeemabMehmood's full-sized avatar

Syeda Seemab Mehmood SeemabMehmood

View GitHub Profile
@SeemabMehmood
SeemabMehmood / richest_cust_wealth.rb
Created September 20, 2023 04:50
Richest Customer Wealth
accounts = [[7, 1, 3],
[2, 8, 7],
[1, 9, 5]]
sums = []
for i in 0..accounts.length
sums << accounts[i].sum
end
sums.max
@SeemabMehmood
SeemabMehmood / running_sum.rb
Created September 20, 2023 04:48
Running Sum
n = [3, 1, 2, 10, 1]
for i in n.length
n[i] += n[i-1]
end
# Time Complexitiy: O(n)
# Space Complexity: constant O(1)