Array interview problem | Java code || Maximum Product Subarray :- Blind 75 : Leetcode 152 | Optimal

preview_player
Показать описание
#array #interview #problem #dynamic #programming # leetcode152

Learning Array problem for interview with java code, and solving with dynamic programming to arrive at optimal solution, with Big O time and space complexity. This will also be a walkthrough the problem, understanding core concept of array traversal, hashing, hashtable, sorting, sliding window and array traversal, using And and Or operator at binary level.

Leetcode easy: array traversal + Dynamic programming.

Not stopping till we get employed in FAANG.

Problem asked recently in following companies in coding interview:
LinkedIn interview,
Amazon interview,
Microsoft interview,
Bloomberg interview,
Google interview,
Apple interview,
Facebook interview,

List of Most Important Questions and Solutions:

GitHub Repository for Questions solved so far:

My dream IT companies:

FAANG,
Facebook,
Google,
Amazon,
Netflix,
Microsoft,
apple,
doordash,
roblox,
stripe,
instacart,
uber,
lyft,
twitter,
linked In,
pinetrest,
bloomberg,
robinhood,
box,
two sigma,
byte dance,
tik tok,
air bnb,
nuro,
ui path,
oracle,
twitch,
data bricks,
waymo,
dropbox,
coinbase,
snowflake,
snap,
nvdia,
broadcom,
slack,
intel,
cisco,
indeed,
salesforce,
reddit,
wayfair,
okta,
splunk,
service now,
coursera,
square,
upgrade,
mozilla,
yelp,
unity,
ebay,
affirm,
stach adapt,
amplitude,
github,
wish,
brex,
etsy,
chime,
shopify,
amd,
GoDaddy,
IBM,
Рекомендации по теме
Комментарии
Автор

Coding

class Solution {
public int maxProduct(int[] nums) {
int maxProduct = 1;
int minProduct = 1;
int result = nums[0];

for(int i = 0; i<nums.length; i++){

int temp = maxProduct* nums[i];
maxProduct = Math.max(nums[i], Math.max(maxProduct* nums[i], minProduct* nums[i]));
minProduct = Math.min(nums[i], Math.min(temp, minProduct * nums[i]));

result = Math.max(result, Math.max(minProduct, maxProduct));
}

return result;
}
}

DestinationFAANG
Автор

is the previous maximum sum of an array also a dynamic programming solution?

VioletClaw
visit shbcf.ru