love-babbar-dsa-cracker-sheet-solutions's People
Forkers
amanjot726 manson010 shekhargit1912 deepak89335 js899 iamshubhamjangle hahahamid md9291 gourav1695 ada01-08-2000 parth1507 vaishalparikh yashashree722 mmonis440 lalithcodelover theamitmehra saurabhdayma gulshan2702 paraskalyan nileshsrivastava27 dash-09 quibler7 rohitsinha969 akash-1107 tejasrockshere divya-bhujbal alishabhale madhu-sekhar sankalpcodes rajat4665 aryanmahawar205 shubham121slove-babbar-dsa-cracker-sheet-solutions's Issues
Issue in code for Maximum Product Subarray
https://leetcode.com/problems/maximum-product-subarray/
Issue:
[-2,0,-1] consider this array your code will give output as 1 but the actual output is 0.
Python code is not correct.
def minJumps(self, arr, n):
if n ==1:
return 0
if arr[0]==0:
return -1
maxReach=arr[0]
step=arr[0]
jump=1
for i in range(1,n):
if i==n-1:
return jump
maxReach=max(maxReach,i+arr[i])
step-=1
if step==0:
jump+=1
if i>=maxReach:
return -1
step=maxReach-i
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.