Tag: math algorithm
An array contains all the integers from 0 to n, except for one number which is missing. Write code to find the missing integer. Can you do it in O(n) …
You are given a string s and an integer k. Return the number of palindromes you can construct of length k using only letters in s. Letters can be …
Consider the following function to make changes to an array of numbers: func modify(arr, op, idx) { // add by 1 index idx if (op == 0) { arr …
Given a binary string s (a string consisting only of ‘0’ and ‘1’s). Return the number of substrings with all characters 1’s. Since the answer may be too large, …
For a web developer, it is very important to know how to design a web page’s size. So, given a specific rectangular web page’s area, your job by now …