(Chromatic Harmonica Tabs)

6   6      6    5      6   -6   6     5
De Camptown ladies sing this song,
5 -4 5 -4
Doo-da, Doo-da
6 6 6 5 6 -6 6 5
De Camptown racetrack’s two miles long
-4 -4 5 -4 4
Oh, de doo-da day.
[Refrain]
4 4 5 6 7
G’wine to run all night
-6 -6 7 -6 6
G’wine to run all day
6 6 6 5 6 6 6 -6 6 6
I bet my money on a bob-tailed nag
-4 -4 -4 5 -4 -4 4
Somebody bet on the gray

- Draw in

nil — Blow


Respite from coding :)

Here’s the tabs. Added lyrics for you to “hear the notes” and “keep the rythme”.

7B 7D 7B 6B 7B 7D 7B 6B

Silent Night, Holy Night

9D 9D 8D 8B 8B 7B

All is calm, All is Bright

7D 7D 8B 8D 7D 7B 7D 7B 6B

Round yon virgin, mother and child

7D 7D 8B 8D 7D 7B 7D 7B 6B

Holy Infant, so tender and mild

9D 9D 10D 9D 8D 8B 9B

Sleep in heavenly peach, ooh

8B 7B 6B 7B 6D 5D 5B

Sleep, sleep in heaven, heavenly peace

Legends:
B — Blow
D — Draw (Suck in air)

This story is a result of spending two years of intensive coding of questions on Data Structures and Algorithm questions on platforms like Lintcode and Leetcodes. I had always publish on solutions to thorny questions that I encountered so as to alleviate the pain of the next learner.

I will take a different tack here and focused on the efficient Python techniques picked up. These are usually non-obvious tricks through much searching of techniques to be more efficient in writing less code and be more Pythonic. So credits go to the great wide web.

Photo by Alex Chumak on Unsplash

1. Sum of a 2D matrix with least amount of code

adjacencyList = [[1, 0, 0], [1…


Photo by Anthony Fomin on Unsplash
> pyinstaller main.py

1. Option Command: — name

> pyinstaller --name Pomodoro main.py

2. Option Command: — add-data

> pyinstaller --name Pomodoro --add-data "./tomato.png:." main.py

Problem — Find K Pairs with Smallest Sums

You are given two integer arrays nums1 and nums2 sorted in ascending order and an integer k. Define a pair (u,v) which consists of one element from the first array and one element from the second array.
Find the k pairs (u1,v1),(u2,v2) …(uk,vk) with the smallest sums.
Return results need to be orderly.

Example:
Given nums1 = [1,7,11], nums2 = [2,4,6], k = 3
Return: [1,2],[1,4],[1,6]

First Step

The two arrays are monotonic increasing. So it stands to reason that the first elements in each of the arrays when summed, will give the pair with smallest sum. From the diagram below, the…


Problem

In the world of the moon, ordinary people will solve a problem. This problem is a string of English letters. Each time you can delete an English letter. Try to delete as few times as possible to make the various letters’ frequency appear differently. The number of deletion is the answer of the calculation that needs to be returned.

Photo by Amador Loureiro on Unsplash

Thinking about the problem

Quite intuitively, we should straight away think of histogram of the letters and their frequency. The question gave the example of the string “aaabbb”. Below diagram put them in histogram form. Immediately, we could understand that to ensure the two letters…


Lintcode 257 or Leetcode 1048

Question setup

Given a list of words, each word consists of English lowercase letters.
Let’s say word1 is a predecessor of word2 if and only if we can add exactly one letter anywhere in word1 to make it equal to word2. For example, “abc” is a predecessor of “abac”.
A word chain is a sequence of words [word_1, word_2, …, word_k] with k >= 1, where word_1 is a predecessor of word_2, word_2 is a predecessor of word_3, and so on. …

Mipsmonsta

Writing to soothe the soul, programming to achieve flow

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store