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 is a function to pull all the keys from a map and return them | |
// Its bad because it only works for strings right now | |
func getKeys(m map[string]int) []string { | |
var keys []string | |
for k := range m { | |
keys = append(keys, k) | |
} | |
return keys | |
} |
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
.intercom-app, | |
.intercom-launcher-frame, | |
#intercom-container { | |
display: none !important; | |
} | |
button, | |
input, | |
optgroup, | |
select, |
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
/* | |
Given a 0-indexed string word and a character ch, reverse the segment of word that starts at index 0 and ends at the index of the first occurrence of ch (inclusive). If the character ch does not exist in word, do nothing. | |
For example, if word = "abcdefd" and ch = "d", then you should reverse the segment that starts at 0 and ends at 3 (inclusive). The resulting string will be "dcbaefd". | |
Return the resulting string. | |
Example 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
/* | |
Given a string s consisting of some words separated by some number of spaces, return the length of the last word in the string. | |
A word is a maximal substring consisting of non-space characters only. | |
Example 1: | |
Input: s = "Hello World" |
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
/* | |
Given a 32-bit signed integer, reverse digits of an integer. | |
Example 1: | |
Input: 123 | |
Output: 321 | |
Example 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
/* | |
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward. | |
Example 1: | |
Input: 121 | |
Output: true | |
Example 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
/* | |
Merge two sorted linked lists and return it as a new sorted list. The new list should be made by splicing together the nodes of the first two lists. | |
Example: | |
Input: 1->2->4, 1->3->4 | |
Output: 1->1->2->3->4->4 | |
*/ |
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
use std::thread; | |
use std::time::Duration; | |
fn main() { | |
// this thread will die when the main thread has ended | |
// but this spawned thread will start printing outputs while the main thread continues on | |
thread::spawn(|| { | |
for i in 1..10 { | |
println!("hi number {} from the spawned thread!", i); | |
thread::sleep(Duration::from_millis(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
use std::cell::RefCell; | |
use std::rc::{Rc, Weak}; | |
// Implementation of a basic tree with out a cyclical reference, using strong and weak references | |
/* | |
* Every node is going to own its children, but share them so we can access each node directly | |
* to accomplish this, we make every child a Vec<T> and T is an Rc<Node> to maintain a reference count for the smart pointers | |
* We also need to be able to modify nodes that are children of other nodes | |
* to accomplish this we wrap each child Vec in RefCell<T> | |
* We also need to track who is the parent of the node |
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
/* | |
Write a function to find the longest common prefix string amongst an array of strings. | |
If there is no common prefix, return an empty string "". | |
Example 1: | |
Input: ["flower","flow","flight"] | |
Output: "fl" |
NewerOlder