# Palindrome with JavaScript

I was trying to approach this problem by splitting half. For example,

set the mid “4” and then split left and right. Define these like left = [1,2], right=[2,1] and mid=4. So all i have to do is right.reverse() to compare with left part. if(left === right.reverse()) should return “YES” else it’s not!

If the each row’s length is even number,

For example, if the length is 6, the left and right length should be 3.

# Summary

• Giveaway free crypto is the future of corporation’s marketing rewards
• Experience compounding interest on Binance platform
• Fundraise from crypto to invest in great stocks such as Alphabet(\$GOOG), Berkshire Hathaway(\$BRK/B) and The Estée Lauder Companies(\$EL)
• Stock dividend will help to boost the return
• Remember this equation. 3rd party mining apps +…

# Buying a Macbook with crypto

Here’s how I got involved in crypto world. I am actually stock investor and do not trust in crypto value like other investors. Nowadays, people buy a Tesla with Bitcoin. So i was thinking like i’m a software developer so why not buy the new Macbook 2021 model for myself?

# DOUBLE MY MONEY

I’ve been managing risk-free investment portfolio. I still try to keep another portfolio for my future which i’m not going to share with anyone on the internet. …

# BOJ 10809 — find an alphabet

Input

output

It was a bit hard to understand what it was asking at the beginning. But i tried to understand after comparing…

# Stack — 10828

Stack is one of data structure.

I didn’t use Logical OR (||) that much before.

// stack list
// stack = []
// 1 — (1) — del & print
// 2 — (2) — del & print
// empty stack
// 3 — push(12)

// 2…

# Two Sum — Leetcode 1

At the first time, i used nested for loop. so the worst case of time complexity is O(n²).

This is a brute-force example.

Pseudocode

// [2,7,11,15]
// for looop nums[i] === 2
// another for loop
// for { [0]
// for { // [1]
// if(nums[i] + nums[j] === target) {
// return [i, j]
// }
// }
// }

The worst case of time complexity is O(n²).
If we want to do it in a better PS, we could do with hash map.

Hash map is key-value structure.

Pseudocode

// sort nums arr in order
// [2,3,4];
// nums[i] + num[i+1] === target and then do arr.shift()
// return arr
// else

# Searching Algorithms

JavaScript has search methods for arrays.

• indexOf
• includes
• find
• findIndex

# Linear search

Loop through the array and check if there’s a matched element, return the index. If there’s not, just simply return -1

# React hooks with TypeScript

1. useState

we don’t really define the types in useState.
import useState from react

whatever we put the initial value, we have to stick to it. For example, the above example is defined with boolean type. Now we can inform TS that the type of User can be null or AuthUser.

2. useReducer

## iDevBrandon

Investor & Software Developer

Get the Medium app