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
/* Given the following binary tree | |
6 | |
/ \ | |
3 4 | |
/ / \ | |
5 1 0 | |
\ / | |
2 8 | |
/ \ | |
9 7 |
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
using System; | |
namespace ColumnOrder { | |
class Node{ | |
private Node _left; | |
private Node _right; | |
private int _value; | |
public Node(int val){ | |
_value = val; |
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
#add google-cloud-storage == 2.1.0 to requirements.txt | |
""" | |
curl -m 70 -X POST https://<cf-url> \ | |
-H "Authorization:bearer $(gcloud auth print-identity-token)" \ | |
-H "Content-Type:application/json" \ | |
-d '{ | |
"source_bucket_name":"<replace-with-bucket-name>", | |
"destination_bucket_name":"<replace-with-dest-bucket-name>", | |
"folder":"<folder-to-transfer>/" |
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
val settingsBuilder = BigtableDataSettings.newBuilder() | |
settingsBuilder.setProjectId("projectId") | |
settingsBuilder.setInstanceId("instanceId") | |
settingsBuilder.setAppProfileId("default") | |
val grpcSettings = EnhancedBigtableStubSettings.defaultGrpcTransportProviderBuilder() | |
grpcSettings.setMaxInboundMessageSize(550000000) | |
println("Before Building Client Settings: ") | |
println(grpcSettings.getMaxInboundMessageSize().toString) | |
settingsBuilder.stubSettings().setTransportChannelProvider(grpcSettings.build()) | |
val settings = settingsBuilder.build() |
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
#https://www.facebookrecruiting.com/profile/preparation_hub | |
""" | |
4 | |
/ \ | |
2 8 | |
/ \ / \ | |
3 N 6 9 | |
\ | |
N N N N N N N 7 |
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
n = 10 | |
g = [[3,7], | |
[6,2], | |
[10,4], | |
[4,8], | |
[6,8], | |
[3,1], | |
[2,9], | |
[2,8], | |
[6,9], |
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 google.cloud import storage | |
from zipfile import ZipFile | |
import os | |
def compress(request): | |
"""Responds to any HTTP request. | |
Args: | |
request (flask.Request): HTTP request object. | |
Returns: |
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 sys | |
class Trie: | |
def __init__(self): | |
self.childs = {} | |
self.isEnd = False | |
def addWord(self,word): | |
current = self | |
for w in word: | |
if w not in current.childs: |
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
def spiralPathMatrix(matrix, n, m): | |
# right down left up | |
directions = [1,0,0,0] | |
verticalLimit = 0 | |
horizontalLimit = 0 | |
iterations = (n * m ) | |
row,col = [0,0] | |
direction = 0 # we moving right | |
prev = 0 | |
items = [matrix[0][0]] |
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
def eval_expr(operand,a,b): | |
if operand == '+': | |
return a + b | |
elif operand == '-': | |
return a - b | |
elif operand == '*': | |
return a * b | |
else: | |
return a / b |
NewerOlder