Check Permutation: Given two strings, write a method to decide if one is a permutation of the other.
I’m working through algorithm exercises with a group of people, and there was a lot of confusion about what permutation means, and how it differs from anagrams and palindromes.
So, to clarify:
A permutation is one of several possible variations, in which a set of things (like numbers, characters or items in an array) can be ordered or arranged. A permutation of characters does not have to have meaning.
Example: Given the string
abcd, the permutations are
An anagram is a word, phrase, or name formed by rearranging the characters of a string. An anagram must have meaning, it can’t just be gibberish.
Example: These words are anagrams of
A palindrome is a word, phrase, or sequence that reads the same backward as forward. A palindrome must have meaning, it can’t just be gibberish.
noon are all palindromes.
All palindromes and anagrams are permutations, but not all permutations are either anagrams or palindromes.
I’m reviving a 2013 MacBook Pro with a clean install and fresh setup. This is mostly documentation for myself.
Install some apps
At this point I decided to take the opportunity to learn something new. A coworker had recently taught us about dotfiles at our weekly tech check-in, so I wanted to see if I could install the rest of my apps using Homebrew.
I installed Homebrew and Homebrew Bundle and created a Brewfile based on what I had installed on my work machine. I created a dotfiles folder in my Documents folder and stored the Brewfile in the dotfiles folder. Then I opened that directory in Terminal and ran
Last couple of steps to reach basic usability:
- make bash auto-complete case insensitive with
echo "set completion-ignore-case On" >> ~/.inputrc
- setup git/ssh keys
At this point it’s been about 1.5 hours since I started.
My Specific App Setup / Persnickety Shit
Add licenses for Alfred, Bartender, BetterTouchTool and HyperDock
Setup/log into Airdroid, Alfred, Bartender, BetterTouchTool, Franz, HyperSwitch, HyperDock, Kindle, ReadKit, Slack, Spillo, Stretchly, Todoist (copy settings for ReadKit and Spillo from previous settings manually)
Add Spillo, ReadKit, Chrome, Slack, Franz to dock
Install SetApp apps
Customize right-click menu
Enable dragging by swiping on trackpad:
System Preferences > Accessibility > Mouse & Trackpad > Trackpad Options > Enable dragging
Enable git colorized output:
git config --global color.ui auto
Setup VSCode with Settings Sync extension (Gist)
Add git auto-completion: https://www.linkedin.com/pulse/how-enable-git-tab-completion-bash-mac-os-x-conor-livingston/
A co-worker recently brought to my attention that I always reach for
console.log when I’m trying to figure out why some code is not behaving as I expect. It’s rather like always reaching for a hammer and ignoring the screwdrivers and wrenches. Sometimes a hammer is the right tool. Sometimes it’s not. Ultimately, scattering
console.log around your code like fairy dust is not a particularly effective debugging method.
These are some things I’m reading to branch out and get comfortable with more debugging tools and techniques:
- /dev tips
- How to stop using console.log() and start using your browser’s debugger
- CSS Debugging and Optimization: Browser-based Developer Tools
- Art of debugging with Chrome DevTools
- Tips and Tricks for Debugging in Chrome Developer Tools
- Conditional Breakpoints in Chrome are Awesome
I hope these links are helpful to others looking to improve their debugging processes!