"public static List Merge(List array1, List array2)
{
if (array1.Count == 0) return array2;
if (array2.Count == 0) return array1;
var result = new List();
// Identify starting array, array with largest starting element
var array = array1[0] > array2[0] ? array2 : array1;
var other = array1[0] > array2[0] ? array1 : array2;
// loop until we hit end of an array
int arrayIndex = 0;
int otherIndex = 0;
while(arrayIndex"
Mark S. - "public static List Merge(List array1, List array2)
{
if (array1.Count == 0) return array2;
if (array2.Count == 0) return array1;
var result = new List();
// Identify starting array, array with largest starting element
var array = array1[0] > array2[0] ? array2 : array1;
var other = array1[0] > array2[0] ? array1 : array2;
// loop until we hit end of an array
int arrayIndex = 0;
int otherIndex = 0;
while(arrayIndex"See full answer
"
O(n) time, O(1) space
from typing import List
def maxsubarraysum(nums: List[int]) -> int:
if len(nums) == 0:
return 0
maxsum = currsum = nums[0]
for i in range(1, len(nums)):
currsum = max(currsum + nums[i], nums[i])
maxsum = max(currsum, max_sum)
return max_sum
debug your code below
print(maxsubarraysum([-1, 2, -3, 4]))
`"
Rick E. - "
O(n) time, O(1) space
from typing import List
def maxsubarraysum(nums: List[int]) -> int:
if len(nums) == 0:
return 0
maxsum = currsum = nums[0]
for i in range(1, len(nums)):
currsum = max(currsum + nums[i], nums[i])
maxsum = max(currsum, max_sum)
return max_sum
debug your code below
print(maxsubarraysum([-1, 2, -3, 4]))
`"See full answer
"I would start with the company vision then assuming we have more than one product team, craft the vision for the product through a collaboration of PMs and Tech leads, then based on that I will define the scope of each product team's milestones to achieve the product vision and go from both ends to fill the gap from what we already have and what needed to achieve the milestones."
Seyed rasoul J. - "I would start with the company vision then assuming we have more than one product team, craft the vision for the product through a collaboration of PMs and Tech leads, then based on that I will define the scope of each product team's milestones to achieve the product vision and go from both ends to fill the gap from what we already have and what needed to achieve the milestones."See full answer
"When it comes to Metrics, I always think of one thing " What cannot be measured cannot be done".
The product that I am managing goal is on enabling the products for our partners so that our partners can have a seamless experience of doing business with us which in turn will increase the revenue. The user segment for my product is mainly resellers who can resell the product to another customer so that the reach of the customers is more. The metrics which I am tracking are revenue, referrals, an"
Tanu M. - "When it comes to Metrics, I always think of one thing " What cannot be measured cannot be done".
The product that I am managing goal is on enabling the products for our partners so that our partners can have a seamless experience of doing business with us which in turn will increase the revenue. The user segment for my product is mainly resellers who can resell the product to another customer so that the reach of the customers is more. The metrics which I am tracking are revenue, referrals, an"See full answer
"from typing import List
def traprainwater(height: List[int]) -> int:
if not height:
return 0
l, r = 0, len(height) - 1
leftMax, rightMax = height[l], height[r]
res = 0
while l < r:
if leftMax < rightMax:
l += 1
leftMax = max(leftMax, height[l])
res += leftMax - height[l]
else:
r -= 1
rightMax = max(rightMax, height[r])
"
Anonymous Roadrunner - "from typing import List
def traprainwater(height: List[int]) -> int:
if not height:
return 0
l, r = 0, len(height) - 1
leftMax, rightMax = height[l], height[r]
res = 0
while l < r:
if leftMax < rightMax:
l += 1
leftMax = max(leftMax, height[l])
res += leftMax - height[l]
else:
r -= 1
rightMax = max(rightMax, height[r])
"See full answer
"function isPalindrome(s, start, end) {
while (s[start] === s[end] && end >= start) {
start++;
end--;
}
return end <= start;
}
function longestPalindromicSubstring(s) {
let longestPalindrome = '';
for (let i=0; i < s.length; i++) {
let j = s.length-1;
while (s[i] !== s[j] && i <= j) {
j--;
}
if (s[i] === s[j]) {
if (isPalindrome(s, i, j)) {
const validPalindrome = s.substring(i, j+1"
Tiago R. - "function isPalindrome(s, start, end) {
while (s[start] === s[end] && end >= start) {
start++;
end--;
}
return end <= start;
}
function longestPalindromicSubstring(s) {
let longestPalindrome = '';
for (let i=0; i < s.length; i++) {
let j = s.length-1;
while (s[i] !== s[j] && i <= j) {
j--;
}
if (s[i] === s[j]) {
if (isPalindrome(s, i, j)) {
const validPalindrome = s.substring(i, j+1"See full answer
"Leetcode 347: Heap + Hashtable
Follow up question: create heap with the length of K instead of N (more time complexity but less space )"
Chen J. - "Leetcode 347: Heap + Hashtable
Follow up question: create heap with the length of K instead of N (more time complexity but less space )"See full answer
"import java.util.Arrays;
import java.util.stream.Collectors;
class Main
{
// Recursive function to print all combinations of numbers from \i\ to \n\
// having sum \n. The index\ denotes the next free slot in the output array \out\
public static void printCombinations(int i, int n, int[] out, int index)
{
// if the sum becomes n, print the combination
if (n == 0)
{
System.out.println(Arrays.stream(out).limit(index)
.boxed().collect(Collectors.toList()));
}
// start from the previous e"
Relynn may silver B. - "import java.util.Arrays;
import java.util.stream.Collectors;
class Main
{
// Recursive function to print all combinations of numbers from \i\ to \n\
// having sum \n. The index\ denotes the next free slot in the output array \out\
public static void printCombinations(int i, int n, int[] out, int index)
{
// if the sum becomes n, print the combination
if (n == 0)
{
System.out.println(Arrays.stream(out).limit(index)
.boxed().collect(Collectors.toList()));
}
// start from the previous e"See full answer