See how a minor change to your commit message style can make you a better programmer.
Format: <type>(<scope>): <subject>
<scope>
is optional
package bank | |
trait BankOperations { | |
def createAccount(accountName: String, phoneNumber: String, openingBalance: Double) | |
def depositFund(accountName: String, amount: Double) | |
def withdrawFund(accountNumber: String, amount: Double) | |
// TODO: Add update data probably later? |
The algorithms differ so it's unfair to compare them even though Go is still faster. This was called to my attention by opeispo :)
Memory: 2.4MB Time: 4ms
You and your rescued bunny prisoners need to get out of this collapsing death trap of a space station - and fast! Unfortunately, some of the bunnies have been weakened by their long imprisonment and can't run very fast. Their friends are trying to help them, but this escape would go a lot faster if you also pitched in. The defensive bulkhead doors have begun to close, and if you don't make it through in time, you'll be trapped! You need to grab as many bunnies as you can and get through the bulkheads before they close.
The time it takes to move from your starting point to all of the bunnies and to the bulkhead will be given to you in a square matrix of integers. Each row will tell you the time it takes to get to the start, first bunny, second bunny, ..., last bunny, and the bulkhead in that order. The order of the rows follows the same pattern (start, each bunny, bulkhead). The bunnies can jump into your arms, so picking them up is instantaneous, and arriving at th
Being a henchman isn't all drudgery. Occasionally, when Commander Lambda is feeling generous, she'll hand out Lucky LAMBs (Lambda's All-purpose Money Bucks). Henchmen can use Lucky LAMBs to buy things like a second pair of socks, a pillow for their bunks, or even a third daily meal!
However, actually passing out LAMBs isn't easy. Each henchman squad has a strict seniority ranking which must be respected - or else the henchmen will revolt and you'll all get demoted back to minions again!
There are 4 key rules which you must follow in order to avoid a revolt: 1. The most junior henchman (with the least seniority) gets exactly 1 LAMB. (There will always be at least 1 henchman on a team.) 2. A henchman will revolt if the person who ranks immediately above them gets more than double the number of LAMBs they do.
class Node { | |
constructor(data = 0, next=null) { | |
this.data = data; | |
this.next = next | |
} | |
} | |
class LinkedList { | |
constructor(value = 0){ | |
this.head = new Node(value) |
q, res = deque(), [] | |
for i, v in enumerate(nums): | |
while q and v > nums[q[-1]]: | |
q.pop() | |
while len(q) < min(i+1,k): | |
q.append(i) | |
if i >= k-1: | |
res.append(nums[q.popleft()]) | |
return res |
{"key":"node:visited","completion":0.8176666666666667,"user_id":"c6856d12-a369-47d0-b044-69292417137e","username":"Ayobami Adedapo","node_id":"5653767e-686a-473e-9528-06e8832ea104","connectedNodes":["b06bcc17-0385-4c2f-a76c-2b27ead15bbd"],"message":"Ayobami Adedapo just hit node 5653767e-686a-473e-9528-06e8832ea104","time":"2020-07-22T15:17:36.940Z","node":"2633"} | |
{"key":"node:visited","completion":0.8176666666666667,"user_id":"04425293-d9fd-448a-82bb-c6ec05ecc1ec","username":"Abdulazeez Abdulazeez","node_id":"6c89f5a9-0758-4ef5-ad65-ef41af73fd6f","connectedNodes":["41c83a18-5df1-4cc7-bbb1-9754ddadb086","1759f02e-880c-47c7-adf4-913eeda487e2","45f02eb9-0bd4-4a34-b445-41ce31c2983d"],"message":"Abdulazeez Abdulazeez just hit node 6c89f5a9-0758-4ef5-ad65-ef41af73fd6f","time":"2020-07-22T15:17:37.169Z","node":"690"} | |
{"key":"node:visited","completion":0.8176666666666667,"user_id":"04425293-d9fd-448a-82bb-c6ec05ecc1ec","username":"Abdulazeez Abdulazeez","node_id":"65297a84-14d4-4eff-80ea-f4fe4d77633a","connectedNode |
class Trie: | |
def __init__(self): | |
""" | |
Initialize your data structure here. | |
""" | |
self.root = {} | |
def insert(self, word: str) -> None: | |
""" | |
Inserts a word into the trie. |
In today's session, we'd chill and vibe as usual over a couple of questions. Some of the questions will be in this Gist and we might choose some randomly from LeetCode. The questions are listed below, answers will be posted here subsequently.
Write a program that takes an array A and an index i rnto A, and rearranges the elements such
that all elements less than A[r] (the "pivot") appear first, followed by elements equal to the pivot,
followed by elements greater than the pivot. You are expected to have a function solution(array, index)
Example: