Posts by Category

Leetcode

Leetcode problem 131 - Insert Interval

1 minute read

You are given an array of non-overlapping intervals intervals where intervals[i] = [starti, endi] represent the start and the end of the ith interval and int...

Leetcode problem 130 - Merge Intervals

less than 1 minute read

Given an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals, and return an array of the non-overlapping intervals that c...

Leetcode problem 124 - Arithmetic Subarrays

2 minute read

A sequence of numbers is called arithmetic if it consists of at least two elements, and the difference between every two consecutive elements is the same. Mo...

Leetcode problem 120 - Subrectangle Queries

2 minute read

Implement the class SubrectangleQueries which receives a rows x cols rectangle as a matrix of integers in the constructor and supports two methods:

Leetcode problem 118 - Row With Maximum Ones

2 minute read

Given a m x n binary matrix mat, find the 0-indexed position of the row that contains the maximum count of ones, and the number of ones in that row.

Leetcode problem 113 - Richest Customer Wealth

1 minute read

You are given an m x n integer grid accounts where accounts[i][j] is the amount of money the i​​​​​​​​​​​th​​​​ customer has in the j​​​​​​​​​​​th​​​​ bank. ...

Leetcode problem 105 - Longest Nice Substring

2 minute read

A string s is nice if, for every letter of the alphabet that s contains, it appears both in uppercase and lowercase. For example, “abABB” is nice because ‘A’...

Leetcode problem 104 - Defuse the Bomb

2 minute read

You have a bomb to defuse, and your time is running out! Your informer will provide you with a circular array code of length of n and a key k.

Leetcode problem 95 - Merge Strings Alternately

1 minute read

You are given two strings word1 and word2. Merge the strings by adding letters in alternating order, starting with word1. If a string is longer than the othe...

Leetcode problem 93 - Reverse Prefix of Word

2 minute read

Given a 0-indexed string word and a character ch, reverse the segment of word that starts at index 0 and ends at the index of the first occurrence of ch (inc...

Leetcode problem 85 - DI String Match

1 minute read

A permutation perm of n + 1 integers of all the integers in the range [0, n] can be represented as a string s of length n where:

Leetcode problem 84 - Array Partition

1 minute read

Given an integer array nums of 2n integers, group these integers into n pairs (a1, b1), (a2, b2), …, (an, bn) such that the sum of min(ai, bi) for all i is m...

Leetcode problem 77 - H-Index

2 minute read

Given an array of integers citations where citations[i] is the number of citations a researcher received for their ith paper, return the researcher’s h-index.

Leetcode problem 71 - Merge Sorted Array

2 minute read

You are given two integer arrays nums1 and nums2, sorted in non-decreasing order, and two integers m and n, representing the number of elements in nums1 and ...

Leetcode problem 70 - Destination City

1 minute read

You are given the array paths, where paths[i] = [cityAi, cityBi] means there exists a direct path going from cityAi to cityBi. Return the destination city, t...

Leetcode problem 69 - Partition Labels

2 minute read

You are given a string s. We want to partition the string into as many parts as possible so that each letter appears in at most one part.

Leetcode problem 62 - Rings and Rods

2 minute read

There are n rings and each ring is either red, green, or blue. The rings are distributed across ten rods labeled from 0 to 9.

Leetcode problem 57 - Decode the Message

2 minute read

You are given the strings key and message, which represent a cipher key and a secret message, respectively. The steps to decode message are as follows:

Leetcode problem 56 - Design an Ordered Stream

2 minute read

There is a stream of n (idKey, value) pairs arriving in an arbitrary order, where idKey is an integer between 1 and n and value is a string. No two pairs hav...

Leetcode problem 55 - Truncate Sentence

1 minute read

A sentence is a list of words that are separated by a single space with no leading or trailing spaces. Each of the words consists of only uppercase and lower...

Leetcode problem 52 - Shuffle String

1 minute read

You are given a string s and an integer array indices of the same length. The string s will be shuffled such that the character at the ith position moves to ...

Leetcode problem 47 - Watering Plants

3 minute read

You want to water n plants in your garden with a watering can. The plants are arranged in a row and are labeled from 0 to n - 1 from left to right where the ...

Leetcode problem 45 - TwoSum

1 minute read

Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.

Leetcode problem 44 - Search Insert Position

1 minute read

Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it would be if it were ...

Leetcode problem 43 - Jump Game

2 minute read

You are given an integer array nums. You are initially positioned at the array’s first index, and each element in the array represents your maximum jump leng...

Leetcode problem 37 - Goal Parser Interpretation

1 minute read

You own a Goal Parser that can interpret a string command. The command consists of an alphabet of “G”, “()” and/or “(al)” in some order. The Goal Parser will...

Leetcode problem 35 - Richest Customer Wealth

2 minute read

You are given an m x n integer grid accounts where accounts[i][j] is the amount of money the i​​​​​​​​​​​th​​​​ customer has in the j​​​​​​​​​​​th​​​​ bank. ...

Leetcode problem 31 - Jewels and Stones

1 minute read

You’re given strings jewels representing the types of stones that are jewels, and stones representing the stones you have. Each character in stones is a type...

Leetcode problem 21 - Contains Duplicate

1 minute read

Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct.

Leetcode problem 15 - Move Zeroes

1 minute read

Given an integer array nums, move all 0’s to the end of it while maintaining the relative order of the non-zero elements.

Leetcode problem 14 - Can Place Flowers

1 minute read

You have a long flowerbed in which some of the plots are planted, and some are not. However, flowers cannot be planted in adjacent plots.

Leetcode problem 9 - Plus One

1 minute read

You are given a large integer represented as an integer array digits, where each digits[i] is the ith digit of the integer. The digits are ordered from most ...

Leetcode problem 8 - Remove Element

2 minute read

Given an integer array nums and an integer val, remove all occurrences of val in nums in-place. The order of the elements may be changed. Then return the num...

30 Days of Javascript 13 - Sleep

less than 1 minute read

Given a positive integer millis, write an asynchronous function that sleeps for millis milliseconds. It can resolve any value.

30 Days of Javascript 12 - Add Two Promises

1 minute read

Given two promises promise1 and promise2, return a new promise. promise1 and promise2 will both resolve with a number. The returned promise should resolve wi...

30 Days of Javascript 4 - Counter2

1 minute read

Write a function createCounter. It should accept an initial integer init. It should return an object with three functions.

30 Days of Javascript 2 - Counter

1 minute read

Given an integer n, return a counter function. This counter function initially returns n and then returns 1 more than the previous value every subsequent tim...

Leetcode problem 7 - Ransom Note

2 minute read

Given two strings ransomNote and magazine, return true if ransomNote can be constructed by using the letters from magazine and false otherwise.

Back to top ↑

30 days of Javascript

30 Days of Javascript 13 - Sleep

less than 1 minute read

Given a positive integer millis, write an asynchronous function that sleeps for millis milliseconds. It can resolve any value.

30 Days of Javascript 12 - Add Two Promises

1 minute read

Given two promises promise1 and promise2, return a new promise. promise1 and promise2 will both resolve with a number. The returned promise should resolve wi...

30 Days of Javascript 4 - Counter2

1 minute read

Write a function createCounter. It should accept an initial integer init. It should return an object with three functions.

30 Days of Javascript 2 - Counter

1 minute read

Given an integer n, return a counter function. This counter function initially returns n and then returns 1 more than the previous value every subsequent tim...

Back to top ↑

React

React: Refactor code

less than 1 minute read

This is from counter app. render() { let classes = "bg m-2 bg-"; classes += this.state.count === 0 ? "warning" : "primary"; return ( &...

React: Apply CSS

1 minute read

This posting will show you how to apply CSS in two ways, and this is what I learned applying CSS in react project so far. There are two ways more, but these ...

React: Using components

less than 1 minute read

This posting is going to explain how to use components in React.

React: Count app

2 minute read

This is the project using react I want to learn. The purpose of the project is getting familiar with react and learning how to use react features on the proj...

React: How to use bootstrap with react?

less than 1 minute read

I can use Bootstrap which allow front-end features easily while I’m building a react app. Open the terminal and type a below code. $ npm install bootstrap

React: Getting started

1 minute read

What is React? React is a declarative, efficient, and flexible JavaScript library for building user interfaces. It lets you compose complex UIs from small...

Back to top ↑

Javascript

Back to top ↑

MERN project

MERN project - To do app

less than 1 minute read

Create react app named client in the root project folder using create-react-app command

MERN project - A project Manager

6 minute read

The project manager is for management of projects which user can add, view, edit and delete (CRUD functions) a project. This project is used React, bootstrap...

Back to top ↑

Postgresql

Postgresql

1 minute read

What is PostgreSQL?

Postgresql commands

less than 1 minute read

I’ve collected some useful commands for capitalizing on postgresql. It’s going to keep updating whenever I found a command I need.

Back to top ↑

Others

Syntax of markdown

2 minute read

Heading Heading1 Heading2 Heading3 Heading4 Heading5 Heading6

Markup vs Markdown languages

less than 1 minute read

Markup language Markup Language is a type of language that defines rules for indicating the format in which documents are displayed on the screen or speci...

Back to top ↑

SAIT

Back to top ↑

HTML

HTML & HTML5: Basic

1 minute read

This posting is for getting used to HTML & HTML5.

Back to top ↑

CSS

Back to top ↑

Java

Java: Array

less than 1 minute read

Array

Back to top ↑

AWS

Back to top ↑

Bootstrap

Bootstrap: Basic

1 minute read

This page will be my journal learning bootstrap responsive CSS framework.

Back to top ↑

Deployment

Deploy web app with netlify and heroku

1 minute read

I’m going to deploy my web application with Netlify and Heroku which provide free plan for an individual project. These can be alternative way to show my pro...

Back to top ↑

CORS

CORS policy

less than 1 minute read

The problem I had while developing - Cross Origin Resource Sharing (CORS)

Back to top ↑

Python

Python - Variable

less than 1 minute read

Python is dynamically typed, which means I don’t need to explicitly declare the data type of a variable. Python will infer the data type based on the assigne...

Back to top ↑