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
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. | |
# Initialization code that may require console input (password prompts, [y/n] | |
# confirmations, etc.) must go above this block; everything else may go below. | |
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then | |
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" | |
fi | |
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. | |
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh |
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
# Generated by Powerlevel10k configuration wizard on 2021-03-20 at 16:57 AEDT. | |
# Based on romkatv/powerlevel10k/config/p10k-classic.zsh, checksum 40036. | |
# Wizard options: nerdfont-complete + powerline, small icons, classic, unicode, | |
# lightest, angled separators, sharp heads, flat tails, 1 line, compact, few icons, | |
# concise, transient_prompt, instant_prompt=verbose. | |
# Type `p10k configure` to generate another config. | |
# | |
# Config for Powerlevel10k with classic powerline prompt style. Type `p10k configure` to generate | |
# your own config based on it. | |
# |
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
-- Queries and Answers for TWU Biblioteca SQL Assignment | |
-- Author: Lu Shien Lee | |
-- Question 1 | |
SELECT member.name | |
FROM book, member, checkout_item | |
WHERE book.title = "The Hobbit" | |
AND member.id = checkout_item.member_id | |
AND book_id = book.id; |
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
git branch featureBranch | |
# where n is the number of commits to squash | |
git reset --soft HEAD~[n] | |
git commit --amend |
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
# Complete the minTime function below. | |
def minTime(machines, goal): | |
average = 0 | |
big = 0 | |
for mach in machines: | |
average += 1/mach | |
big = max(mach, big) | |
approx = round(goal / average) - 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
def solution(K, M, A): | |
freqs = [0] * (M+1) # freqs[i] = frequency of int i+1, ie from 1-(M+1) | |
# increments[i] = int to have freq incremented when enters window at ind i (range should be 1-M) | |
increments = [0] * len(A) | |
threshold = (len(A) // 2) + 1 | |
leaders = [0] * (M+1) # once leader found, place in matching position in array | |
for i in range(len(A)): | |
num = A[i] | |
increments[i] = num + 1 |
- Use of
defaultdict
in python to shortcutif exists else
code - I need to practice verbally or methodically working through a small example using the algorithm
- Two edge cases made this difficult:
- Edges count as intersections
- 0-radius discs can intersect
https://app.codility.com/programmers/lessons/6-sorting/number_of_disc_intersections/start/
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
def color_graph(graph, colors): | |
# Create a valid coloring for the graph | |
# BFS | |
to_visit = [] | |
to_visit.append(graph[0]) | |
while to_visit: | |
node = to_visit.pop(0) |
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 { | |
public int solution(int[] A) { | |
Arrays.sort(A); | |
// Split into -ve queue and +ve queue | |
ArrayDeque<Integer> negs = new ArrayDeque<>(); | |
ArrayDeque<Integer> pos = new ArrayDeque<>(); | |
for (int i = 0; i<A.length; i++) { | |
int el = A[i]; | |
if (el >= 0) { |
NewerOlder