Duplicate Zeros LeetCode Problem | JavaScriptThis one is a bit tricky question. First, let's look at the problem statement. Given a fixed-length integer array arr, duplicate each occurrence of zero, shifting the remaining elements to the right. Note that elements beyond the length of the origin...Jun 6, 2024 · 3 min readkarthikshetty.hashnode.dev
Squares of a Sorted Array | JavaScript | LeetCodeHere is a solution for an array problem called "Squares of a Sorted Array" using JavaScript. Problem: Given an integer array nums sorted in non-decreasing order, return an array of the squares of each number sorted in non-decreasing order. Now let u...Jun 5, 2024 · 2 min readkarthikshetty.hashnode.dev
Max Consecutive Ones | JavaScript | LeetCodeFirst, we will take a look at the problem statement, Given a binary array nums, return the maximum number of consecutive 1's in the array. Now take a look at the constraints: 1 <= nums.length <= 10<sup>5</sup> This means that the array nums can hav...Jun 4, 2024 · 1 min readkarthikshetty.hashnode.dev
Find Numbers with Even Number of Digits | JavaScript | LeetCodeLet us check the problem statement first: Given an array nums of integers, return how many of them contain an even number of digits. Example one: Example Two: Now take a look at the constraints: 1 <= nums.length <= 500 This means that the array num...Jun 4, 2024 · 2 min readkarthikshetty.hashnode.dev
Two Sum Problem | JavaScriptHere I have given a solution for the 'Two Sum' problem, using JavaScript. If you have any better solution please let me know bellow. Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to tar...May 6, 2024 · 2 min readkarthikshetty.hashnode.dev