Question Find the position of the first occurrence of a substring in a string. Returns -1 if the substring is not found. Origin from: Glassdoor Solution » Yang Zhao on leetcode

Following lists 5 common sort algorithms JavaScript implementation. Bubble Sort function bubble_sort(arr) { if (arr.length arr[j + 1]) { var temp = arr[j]; arr[j] » Yang Zhao on leetcode

Question 2D Matrix(m * n) of positive and negative numbers is given. Matrix is sorted rowwise and columnwise. You have to return the count of -ve » Yang Zhao on leetcode

Question Rotate a one-dimensional array of n elements to the right by k steps. For instance, with n=7 and k=3, the array {a, b, » Yang Zhao on leetcode

Question Given a set S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets » Yang Zhao on leetcode

Question Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 » Yang Zhao on leetcode

Question Implement the following function, FindSortedArrayRotation, which takes as its input an array of unique integers that has been sorted in ascending order, then rotated by » Yang Zhao on leetcode

Question Write an efficient algorithm that searches for a value in an n x m table (two-dimensional array). This table is sorted along the rows and » Yang Zhao on leetcode

Question Given two strings, write a method to decide if one is a permutation of the other. Short Solution // Time complexity: O(nlogn) function isPermutation(a, » Yang Zhao on leetcode

Question Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. Origin from: LeetCode Solution // Time complexity: O(n) function » Yang Zhao on leetcode