This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function isPalindrome(s: string): boolean { | |
| const string = s.replace(/[^A-Za-z0-9]/g, '').toLowerCase() | |
| let left = 0 | |
| let right = string.length - 1 | |
| while (right > left) { | |
| if (string[left] !== string[right]) return false | |
| right-- | |
| left++ | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function generate(numRows: number): number[][] { | |
| const result: number[][] = [] | |
| for (let i = 0; i < numRows; i++) { | |
| const res = new Array(i + 1) | |
| for (let j = 0; j <= i; j++) { | |
| if (j === 0 || j === i) res[j] = 1 | |
| else { | |
| res[j] = (result[i-1][j-1] + result[i-1][j]) | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const arr = [10,11,13,5,6,6,2] | |
| const insertionSort = (arr: number[]) => { | |
| for (let i = 1; i < arr.length; i++) { | |
| let currentValue = arr[i] | |
| let j = i - 1 | |
| while (j >= 0 && arr[j] > currentValue) { | |
| arr[j + 1] = arr[j] | |
| j-- | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const selectionSort = (arr: number[]) => { | |
| for (let i = 0; i < arr.length; i++) { | |
| let minIndex = i | |
| for (let j = i; j < arr.length; j++) { | |
| if (arr[j] < arr[i]) minIndex = j | |
| } | |
| [arr[i], arr[minIndex]] = [arr[minIndex], arr[i]] | |
| } | |
| return arr | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function isValid(s: string): boolean { | |
| const stack: string[] = [] | |
| const pairs: Record<string,string> = { | |
| ')' : '(', | |
| '}' : '{', | |
| ']' : '[' | |
| } | |
| for (let i = 0; i < s.length;i++) { | |
| if (pairs[s[i]] === undefined) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * @param {Object} object | |
| * @param {string|Array<string>} path | |
| * @param {*} [defaultValue] | |
| * @return {*} | |
| */ | |
| export default function get(object, path, defaultValue) { | |
| const path = Array.isArray(pathParam) ? pathParam : pathParam.split('.'); | |
| let index = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * 1. Differentiate Senior and Junior | |
| * 2. Differentiate blast sequence | |
| * 3. Generate Job Title | |
| */ | |
| export const generateJobReccomendationBlast = (targets) => { | |
| const senior = targets.filter((item) => item.yearsOfExperience >= 3) | |
| const junior = targets.filter((item) => item.yearsOfExperience < 3) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type Question = { | |
| question: string, | |
| answer: string | |
| } | |
| type FAQSection = { | |
| title: string, | |
| items: Question[] | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import clsx from 'clsx'; | |
| import { useMemo } from 'react'; | |
| import Image from 'next/image'; | |
| import JobLocationIcon from '@/icons/JobLocationIcon'; | |
| import JobPositionIcon from '@/icons/JobPositionIcon'; | |
| // import JobSalaryIcon from '@/icons/JobSalaryIcon' | |
| import Tag from '@/components/General/Tag'; | |
| import TopCandidateIcon from '@/icons/TopCandidateIcon'; | |
| import { | |
| parseEmploymentType, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const myBook = { title: 'Negeri 5 Menara', author: 'Ahmad Fuadi'} | |
| type Book = typeof myBook | |
| const yourBook: Book; |
NewerOlder