Skip to content

Instantly share code, notes, and snippets.

View LarrySul's full-sized avatar
🎯
Focusing

Sule-Balogun Olanrewaju LarrySul

🎯
Focusing
View GitHub Profile
@oyekanmiayo
oyekanmiayo / MinimumWindowSubstring.java
Last active October 14, 2020 23:24
Minimum Window Substring
class Solution {
// This approach is O(n), where n = length of string s
// The sliding window approach uses two pointers to traverse a string in linear time. Each character is visited
// at most twice
// There's a method `mapHasAllChars` whose time complexity may not be intuitive, so it's worth mentioning. At most
// each map will contain all the characters from the ascii set (0 - 255), so we know that at most we will always visit 256
// keys every time we call this method. So note this =>
// AS LONG AS WE KNOW THE WORST CASE FOR NUMBER OF LOOP ITERATIONS BEFOREHAND, THAT LOOP'S TIME COMPLEXITY IS CONSTANT
public String minWindow(String s, String t) {
//Edge Cases
command usage
git init Creates an empty Git repository in the specified directory.
git clone <repository name> Clones a repository located at <repository name> onto your local machine.
git add <directory> Stages only the specified changes for the next commit. Replace <directory> with a <file> to change a specific file.
git add . Stages new files and modifications without deletions
git add -A Stages all changes
git add -all Equivalent to git add -A
git add -u Stages modifications and deletions without adding new files
git add --update Equivalent to git add -u
git commit -m ”<message>” Commits the staged snapshot. replace <message> with the commit message.
/*
* Using array destructuring, fix the following code to print the keys and values of the `members` Map to the console.
*/
const members = new Map();
members.set('Evelyn', 75.68);
members.set('Liam', 20.16);
members.set('Sophia', 0);
members.set('Marcus', 10.25);