class Solution(object):
def generateParenthesis(self, n):
"""
:type n: int
:rtype: List[str]
"""
result = []
This file contains 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
from dataclasses import replace | |
import numpy as np | |
class Node(): | |
""" | |
Implements an individual node in the Decision Tree. | |
""" | |
def __init__(self, y): |
This file contains 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
spark@spark-VirtualBox:~$ unzip A0184022R_Lab1\ \(4\).zip | |
Archive: A0184022R_Lab1 (4).zip | |
End-of-central-directory signature not found. Either this file is not | |
a zipfile, or it constitutes one disk of a multi-part archive. In the | |
latter case the central directory and zipfile comment will be found on | |
the last disk(s) of this archive. | |
unzip: cannot find zipfile directory in one of A0184022R_Lab1 (4).zip or | |
A0184022R_Lab1 (4).zip.zip, and cannot find A0184022R_Lab1 (4).zip.ZIP, period. | |
spark@spark-VirtualBox:~$ unzip "A0184022R_Lab1\ \(4\).zip" | |
unzip: cannot find or open A0184022R_Lab1\ \(4\).zip, A0184022R_Lab1\ \(4\).zip.zip or A0184022R_Lab1\ \(4\).zip.ZIP. |
This file contains 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
graph = { | |
'a' : ['b','c'], | |
'b' : ['d'], | |
'c' : ['e'], | |
'd' : ['f'], | |
'e' : [], | |
'f' : [] | |
} | |
visited = set() # List to keep track of visited nodes. |
This file contains 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
graph = { | |
'a' : ['b','c'], | |
'b' : ['d'], | |
'c' : ['e'], | |
'd' : ['f'], | |
'e' : [], | |
'f' : [] | |
} | |
visited = set() # List to keep track of visited nodes. |
This file contains 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
graph = { | |
'a' : ['b','c'], | |
'b' : ['d'], | |
'c' : ['e'], | |
'd' : ['f'], | |
'e' : [], | |
'f' : [], | |
'e': [] | |
} |
This file contains 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 | |
# heap = [5,4,6,10,2] | |
# heapq.heapify(heap) | |
# heapq.heappush(heap, 20) | |
# min_elem = heapq.heappop(heap) | |
def klargest(lst, k): | |
lst = [-x for x in lst] | |
heapq.heapify(lst) # O(n) |
This file contains 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 React from "react"; | |
import { BrowserRouter, Routes, Route, Link } from "react-router-dom"; | |
export default function App() { | |
return ( | |
<BrowserRouter> | |
<div> | |
<nav> | |
<ul> | |
<li> |
This file contains 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
""" | |
# Definition for a Node. | |
class Node(object): | |
def __init__(self, val=None, children=None): | |
self.val = val | |
self.children = children | |
""" | |
class Solution(object): | |
def postorder(self, root): |
This file contains 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 "HeaderFile.h" | |
void clangGood () { | |
// simple use after free | |
char *buf; | |
buf = (char*) malloc (50 * sizeof(char)); | |
strcpy(buf, "Hello world!!"); | |
free(buf); | |
char *c = buf; /*ERROR:Invalid memory access to already freed area*/ | |
} |
NewerOlder