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
# Calculates maximum distance between a field and water tower | |
def max_power(fields, towers): | |
fields.sort() | |
towers.sort() | |
i, j = 0, 0 | |
max_distance = 0 | |
while i < len(fields) and j < len(towers): | |
# find the maximum distance between a field and a tower |
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 code Finds the max 'A' count with given keyboard presses. | |
def max_a(n): | |
# initialize dp array with size n + 1 | |
dp = [0] * (n + 1) | |
# loop through the dp array | |
for i in range(1, n + 1): | |
# assign the maximum number of 'A' for dp[i] |
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 code implements a binary search algorithm to find the first number of teaspoons of sugar that makes a cake too sweet | |
def binary_search(n, isTooSweet): | |
# Set left as lower bound, right as upper bound | |
left = 1 | |
right = n | |
# repeat until right - left <= 1 | |
while right - left > 1: | |
# find average of left and right |
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 code implements a binary search algorithm to find the first number of teaspoons of sugar that makes a cake too sweet | |
def binary_search(n, isTooSweet): | |
# Set left as lower bound, right as upper bound | |
left = 1 | |
right = n | |
# repeat until right - left <= 1 | |
while right - left > 1: | |
# find average of left and right | |
mid = (left + right) // 2 |
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
{ | |
"total": 143, | |
"movies": [ | |
{ | |
"id": "771206971", | |
"title": "Madagascar 3: Europe's Most Wanted", | |
"year": 2012, | |
"mpaa_rating": "PG", | |
"runtime": 93, | |
"critics_consensus": "Dazzlingly colorful and frenetic, Madagascar 3 is silly enough for young kids, but boasts enough surprising smarts to engage parents along the way.", |
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
[ | |
{ | |
"Title": "Avatar", | |
"Year": "2009", | |
"Rated": "PG-13", | |
"Released": "18 Dec 2009", | |
"Runtime": "162 min", | |
"Genre": "Action, Adventure, Fantasy", | |
"Director": "James Cameron", | |
"Writer": "James Cameron", |
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
{ | |
"Employees" : [ | |
{ | |
"userId":"rirani", | |
"jobTitleName":"Developer", | |
"firstName":"Romin", | |
"lastName":"Irani", | |
"preferredFullName":"Romin Irani", | |
"employeeCode":"E1", | |
"region":"CA", |