ssh [email protected]
apt-get update
| type MessageHandler = (message: any) => void; | |
| class MessageBus { | |
| private subscribers: Map<string, MessageHandler[]> = new Map(); | |
| // Subscribe to a specific message type | |
| subscribe(messageType: string, handler: MessageHandler): void { | |
| if (!this.subscribers.has(messageType)) { | |
| this.subscribers.set(messageType, []); | |
| } |
ssh [email protected]
apt-get update
I liked the way Grokking the coding interview organized problems into learnable patterns. However, the course is expensive and the majority of the time the problems are copy-pasted from leetcode. As the explanations on leetcode are usually just as good, the course really boils down to being a glorified curated list of leetcode problems.
So below I made a list of leetcode problems that are as close to grokking problems as possible.
| package com.company; | |
| import java.util.ArrayList; | |
| import java.util.Scanner; | |
| public class user { | |
| private String userName; | |
| private String passWord; | |
| private String name; | |
| private double hoursWorked[] = new double[5]; |
| package com.company; | |
| import java.util.Scanner; | |
| public class Main { | |
| public static void main(String[] args) { | |
| Scanner scan = new Scanner(System.in); | |
| int testScore = 0; | |
| int answer; |
| package com.company; | |
| public class Main { | |
| public static void main(String[] args) { | |
| //Default Values | |
| double wallSpace = 115; | |
| double gallonsOfPaint = 1; | |
| double hoursOfLabor = 8; | |
| double dollarCostPerHour = 20; |
| // Practice.cpp : Defines the entry point for the console application. | |
| // | |
| #include "stdafx.h" | |
| #include <iostream> | |
| using namespace std; | |
| struct node //stores an integer and a pointer to the | |
| { //next node |
| #include <iostream> | |
| #include <string> | |
| using namespace std; | |
| void change(string* change_first, string* change_last) // in this function we created a pointer | |
| { | |
| *change_first = "Master"; // this allows us to change the variable because we know its memory address | |
| *change_last = "piece"; |
| #include <iostream> | |
| using namespace std; | |
| void change(int* x) // essential we made a new pointer and pointed it to the same address as p | |
| { | |
| *x = 20; // this dereferences our pointer so we can change the variable. remember this is pointing to the memory on the heap | |
| } | |
| int main() |
| #include "stdafx.h" | |
| #include <string> // to cout a string you need this library | |
| #include <iostream> | |
| using namespace std; | |
| void setName(string *x, string *y) // this doesnt return anything it just modifies the memory address | |
| { | |
| *x = "Dwight"; | |
| *y = "Sucks"; |