This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "EventDispatcher.h" | |
void EventDispatcher::addListener( Listener *l ) | |
{ | |
mListeners.push_back(l); | |
} | |
void EventDispatcher::removeListener( Listener *l ) | |
{ | |
mListeners.erase( std::remove( mListeners.begin(), mListeners.end(), l ), mListeners.end() ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
/* random record description - could be anything */ | |
struct rec | |
{ | |
int x,y,z; | |
}; | |
/* writes and then reads 10 arbitrary records | |
from the file "junk". */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/python3 | |
import math | |
import os | |
import random | |
import re | |
import sys | |
import functools | |
# | |
# Complete the 'passwordCracker' function below. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution: | |
# you need startIdx for this prob | |
def countVowelStrings(self, n: int) -> int: | |
vowels = ['a','e','i','o','u'] | |
result=[] | |
def cvs(curr,n,startIdx): | |
if n==1: | |
result.append(curr) | |
return 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UP=3 | |
LEFT=2 | |
DOWN=1 | |
RIGHT=0 | |
DIRS = [(0,1),(1,0),(0,-1),(-1,0)] | |
def spiral_copy(inputMatrix): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hello |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://binarysearch.com/problems/Rod-Cutting | |
class Solution: | |
def solve(self, prices, n): | |
memoRec=[-1]*(n+1) | |
def rodCutRec(rodLeft,prices): | |
if memoRec[rodLeft]!=-1: | |
return memoRec[rodLeft] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import heapq as hq | |
import sys | |
import math | |
from typing import NamedTuple | |
class Entry(NamedTuple): | |
cost:int | |
node:int | |
class Solution: |