Skip to content

Instantly share code, notes, and snippets.

🎯
Away

Dixie Korley DixieKorley

🎯
Away
Block or report user

Report or block DixieKorley

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@DixieKorley
DixieKorley / three_sum_smallest.py
Last active Jun 20, 2019
Three sum smallest problem
View three_sum_smallest.py
"""Three Sum Smallest"""
def three_sum_smaller(nums, target):
n = len(nums)
if nums is None or n < 3:
return 0
result = 0
for left in range(n - 2):
middle = left + 1
right = n - 1
@DixieKorley
DixieKorley / character_input.py
Last active Jun 24, 2019
Exercises from Practice Python
View character_input.py
from datetime import datetime
"""Character Input Exercise"""
name = input("Hi there. What is your name? ")
age = input("Hey, " + name + ", how old are you? ")
year = datetime.today().year
year_at_hundred = year + (100 - int(age))
end_message = "Nice! Sounds like you will be a 100 in " + str(year_at_hundred) + "!"
print(end_message)
View max_consecutive_ones.py
"""Max Consecutive Ones II"""
def max_consecutive_ones_II(bits):
res = max_count = 0
counter = Counter()
for i in range(len(bits)):
counter[bits[i]] += 1
maxf = max(maxf, counter[bits[i]])
if res - maxf < 1:
res += 1
View longest_substring_count.py
"""With At Most Two Distinct Characters"""
from collections import Counter
def longest_substring_count_at_most_two(s):
counter = Counter()
fast, max_length = 0, 0
for lag, char in enumerate(s):
counter[char] += 1
while len(counter) > 2:
@DixieKorley
DixieKorley / doubly_linked_list.md
Last active Jun 4, 2019
pseudocode for doubly linked list
View doubly_linked_list.md

Pseudocode

Node class

class Node
  **Initialize with input - value**
     value -> value
     prev -> null
     next -> null
View python_notes.md

Notes from SO

Looping

  1. If you're talking about starting over from the beginning of the for loop, there's no way to do that except "manually", for example by wrapping it in a while loop:
should_restart = True
while should_restart:
  should_restart = False
@DixieKorley
DixieKorley / react-bind.md
Created Aug 11, 2018 — forked from fongandrew/react-bind.md
Explaining why we bind things in React
View react-bind.md

Start With This

Before getting to React, it's helpful to know what this does generally in Javascript. Take the following snippet of code. It's written in ES6 but the principles for this predate ES6.

class Dog {
  constructor() {
@DixieKorley
DixieKorley / RAILS_CHEATSHEET.md
Created May 4, 2018 — forked from mdang/RAILS_CHEATSHEET.md
Ruby on Rails Cheatsheet
View RAILS_CHEATSHEET.md

Ruby on Rails Cheatsheet

Architecture

Create a new application

Install the Rails gem if you haven't done so before

@DixieKorley
DixieKorley / vanilla-js-cheatsheet.md
Created Jan 22, 2018 — forked from thegitfather/vanilla-js-cheatsheet.md
Vanilla JavaScript Quick Reference / Cheatsheet
View vanilla-js-cheatsheet.md
@DixieKorley
DixieKorley / hashTable.js
Created Jan 15, 2018 — forked from alexhawkins/hashTable.js
A Simple Hash Table in JavaScript
View hashTable.js
/*HASH TABLE - a dictionary/hash map data structure for storing key/value pairs. Finding
an entry in a hash table takes O(1) constant time(same for 10 as 1 billion items). Whereas
finding an item via binary search takes time proportional to the logarithm of
the item in the list O(logn). Finding an item in a regular old list takes time proportional to
the length of the list O(n). Very slow. Hash Tables = very fast */
var makeHashTable = function(max) {
var storage = [],
hashTableMethods = {
You can’t perform that action at this time.