I hereby claim:
- I am cunla on github.
- I am danielmoran (https://keybase.io/danielmoran) on keybase.
- I have a public key whose fingerprint is 5EE7 4D9D 1454 BBAE 0EA7 57EE 2A74 F32F A0A7 E28C
To claim this, I am signing this object:
var objs = [ | |
{ | |
"name":"a", | |
"age":19 | |
}, { | |
"name":"b", | |
"age":15 | |
}, { | |
"name":"c", | |
"age":16 |
""" | |
Bucket Fill Exercise | |
Imagine you are working on an image editing application. You need to implement a bucket fill tool similar to the one | |
in paint. The user will use the tool by selecting a color and clicking on the canvas. The tool fills the selected | |
region of color with the new color. | |
When a pixel is filled, all of its neighbors (above, below, left, or right) of the same color must also be filled, | |
as well as their neighbors, and so on, until the entire region has been filled with the new color. |
import {Directive, ElementRef, Renderer2} from '@angular/core'; | |
/** | |
* This directive is used with <ion-item-sliding> tag to enable clicking to see | |
* the option buttons seen when swiping. | |
*/ | |
@Directive({ | |
selector: '[click-for-options]', | |
host: { | |
'(click)': 'toggleOptions()', |
from __future__ import print_function | |
import pickle | |
import os.path | |
from io import StringIO | |
from googleapiclient.discovery import build | |
from google_auth_oauthlib.flow import InstalledAppFlow | |
from google.auth.transport.requests import Request | |
SCOPES = ['https://www.googleapis.com/auth/spreadsheets.readonly'] |
import heapq | |
def k_closest_points(points_list, point, k): | |
# Find k closest points to point in points_list | |
points_distance = [] | |
for p in points_list: | |
distance = (p[0] - point[0]) ** 2 + (p[1] - point[1]) ** 2 | |
points_distance.append((distance, p)) | |
heapq.heapify(points_distance) |
import requests | |
CRLF = '\r\n' | |
DEFAULT_HTTP_VERSION = 'HTTP/1.1' | |
class RequestParser(object): | |
def __parse_request_line(self, request_line): | |
request_parts = request_line.split(' ') |
import sys | |
from typing import List | |
def coin_change(coins: List[int], amount: int) -> int: | |
""" | |
Returns the minimum number of coins required to generate amount. | |
Complexity O(amount * len(coins)) | |
:param coins: | |
:param amount: |
import sys | |
from typing import List | |
cost_options = [1, 7, 30] | |
def mincost_tickets(days: List[int], costs: List[int]) -> int: | |
""" | |
In a country popular for train travel, you have planned some train travelling one year in advance. The days of the year that you will travel is given as an array days. Each day is an integer from 1 to 365. |
def is_scramble(s1: str, s2: str) -> bool: | |
if len(s1) != len(s2): | |
return False | |
if len(s1) == 0 or s1 == s2: | |
return True | |
sorted_s1 = sorted(s1) | |
sorted_s2 = sorted(s2) | |
if sorted_s1 != sorted_s2: | |
return False |
I hereby claim:
To claim this, I am signing this object: