https://leetcode.com/problems/two-sum/

Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.You may assume that each input would have exactly one solution, and you may not use the same element twice.You can return the answer in any order.

Hash map, also known as hash table, is a fundamental and powerful data structure to save and retrieve an item in constant time.

In reality at work, an engineer should never write their own hash map, due to the fact that a good hash function is non-trivial to derive. But during an interview, it is good to know the simplest toy implementation of a hash map.

A good practice example can be found at leetcode.com: *706. Design HashMap*

Design a HashMap without using any built-in hash table libraries.Implement the MyHashMap class:

MyHashMap() initializes the object with an empty map.…

Binary search is a fundamental, yet powerful and frequently used algorithm. It has several interesting variations, which are usually skipped in a college CS class or “left as an exercise to the reader”.

It came to me during a coding contest that it is worth the time to possess the full power of binary search with all the beautiful variations, while being “practical” without *formal* math proves (and some horrible 1-indexed array in the math proves, or unnecessary abstraction to relate with binary-tree).

1. Basic Format

Given a **sorted** array of **unique** integers and a **target** integer, return the index…

$100,000 is the start.

The rough idea:

A software engineer at entry level is paid at $100,000 mark. After that, you can expect about 10%~20% increase **on average **year over year, or equivalently, the salary is doubled to $200,000 within five years, and tripled to $300,000 in another three years.

I do not intent to write a science paper based on statistical data, because the median and average are highly skewed in silicon valley comparing to the rest of the world, and consequently the stats are somewhat meaningless. Instead, I will rely on anecdotal stories and first hand experience.

What’s the best programming language for interviews if you are pursuing a software engineer position?

**Python3 **(Or generically *Python*) And I will explain below.

`print('Hello World')`

As a software engineer, I have learned several programming languages at different job positions, I have been interviewed at many companies of different sizes, and I have interviewed many candidates at different levels and backgrounds. The choice of the correct interview language is not a life-or-death matter, per se, but it does make your life much easier before and during tech interviews. So what makes Python3 the best interview language?

Python is a high…

I recently encountered a problem that can be solved efficiently with *Fenwich Tree*, aka *Binary Indexed Tree*. This is the notes about how to explain the algorithm to myself.

**Step 1**. The problem: Given an input array, `nums = [1004, 1009, 1006, 1001, 1002, 1005, 1003, 9999]`

, how to efficiently do sum for any ranges, if element updates allowed?

**Step 2.** To sum up the first `7`

elements, we do (in *Python*) `total = sum(nums[0:7])`

, or verbosely `total = nums[0] + nums[1] + nums[2] + nums[3] + nums[4] + nums[5] + nums[6]`

. Notation `[0:7]`

in *Python* means range from 0…

As a backend engineer, I do not want to use storyboard/nibs/xibs, for reasons.

**Step 1.** Delete *Main.storyboard* in Xcode.

and confirm *Move to trash:*

As a backend engineer, often I feel learning UI/UX is difficult. The concepts and workflows are different, especially when searching online, I could not make sense what are people talking about without a picture and samples.

This is a note to myself: how to initialize an empty app on Xcode11 for iOS13.

**Step 1.** Start Xcode and create a new project, via *File -> New -> Project…* (or *Command+Shift+N* from keyboard)

**Step 2.** Select *Single View App*, then *Next*.

Digital World