Open in app

Sign in

Write

Sign in

Wangyy
Wangyy

57 Followers

Home

About

Mar 20, 2021

Leetcode 38: Count and Say

Let’s solve a medium problem together on Leetcode.com: Count and Say Description The count-and-say sequence is a sequence of digit strings defined by the recursive formula: countAndSay(1) = "1" countAndSay(n) is the way you would "say" the digit string from countAndSay(n-1), which is then converted into a different digit string. To…

3 min read

3 min read


Mar 14, 2021

How to flatten a binary tree to a linked list: recursion approach

Data structures such as binary trees, linked lists are frequently asked in a technical interview. Sometimes, interviewees are asked to transform one data structure to another. For example, convert a list to a linked list, or covert an ordered list to a binary tree, etc. Today, I’ll talk about a…

3 min read

How to flatten a binary tree to a linked list: recursion approach
How to flatten a binary tree to a linked list: recursion approach

3 min read


Mar 4, 2021

Merge Sort a linked list

Sorting algorithms are frequently asked during a technical interview. Several common sorting algorithms such as quicksort, selection sort, merge sort are usually applied to sorting a list. However, sorting a linked list is not straightforward: it’s not easy to access an element by index in constant running time. Most of…

4 min read

Merge Sort a linked list
Merge Sort a linked list

4 min read


Feb 27, 2021

Implement a doubly linked list with Python

Introduction — A singly linked list is a set of linked nodes. Different from a singly linked list, each node in a doubly linked list has an extra pointer points to its previous node. Today, I’ll talk about the implementation of a doubly linked list in python. Implementation in Python Node class A doubly linked…

2 min read

2 min read


Feb 19, 2021

Max area of the island: dfs and bfs approach

For the given island that’s represented in a matrix of 0's and 1's, we usually use a depth-first search or a breadth-first search algorithm to solve. Today, I’ll introduce how to solve and compare such a problem using both approaches. Problem Given a non-empty 2D array grid of 0's and 1's…

3 min read

3 min read


Feb 12, 2021

Solve the sliding window maximum problem

The sliding window algorithm is often used to find the target number in a string/list. Today, I’ll introduce how to solve this leetcode problem using the sliding window algorithm and optimize its running time. Problem description You are given an array of integers nums, there is a sliding window of size k…

5 min read

5 min read


Feb 5, 2021

Implement a Trie in Python

We know tree well, a binary search tree performs well in searching. Today, I’ll introduce another tree-like data structure, which is widely used for retrieval of a key in a dataset of strings: trie. Introduction A trie also called prefix-tree, is a type of search tree, a tree data structure used…

4 min read

Implement a Trie in Python
Implement a Trie in Python

4 min read


Jan 30, 2021

Crack the house robber problem

My previous post introduced the Knapsack problem. It states how to solve using the dynamic programming algorithm. Besides Knapsack, there’s one series of problems that you might encounter in a coding interview: the house robber problems. Today, let’s talk about it. Problem description You are a professional robber planning to rob houses…

5 min read

5 min read


Jan 24, 2021

Intro to dynamic programming knapsack problems

Dynamic programming problems are frequently asked in a tech interview. For me, dynamic programming problems are challenging to understand and to solve. Recently, I see a post demonstrating that dynamic programming problems can be categorized. One of the categories is the Knapsack problem. …

4 min read

Intro to dynamic programming knapsack problems
Intro to dynamic programming knapsack problems

4 min read


Jan 17, 2021

Deal with subset, permutation, combination problems using backtracking algorithm

It’s often asked during a technical interview: write a function to get the subsets/combinations/permutations for a given set. These problems seem difficult to solve in the first place, but have similarities when applying the backtracking algorithm. In this post, I’ll illustrate how to solve these problems using the backtracking algorithm. Definitions …

6 min read

Deal with subset, permutation, combination problems using backtracking algorithm
Deal with subset, permutation, combination problems using backtracking algorithm

6 min read

Wangyy

Wangyy

57 Followers

on the way to become a programmer

Following
  • Yahya Gok

    Yahya Gok

  • Vanessa Martinez

    Vanessa Martinez

  • Alex Sterrantino

    Alex Sterrantino

  • Josh M.R. Allen

    Josh M.R. Allen

  • Leon Jamison

    Leon Jamison

See all (20)

Help

Status

About

Careers

Blog

Privacy

Terms

Text to speech

Teams