Double for loop Leetcode problem | Part 16 | DSA in python in telugu | Engineering Animuthyam

preview_player
Показать описание
Free python dsa course in Telugu | Engineering Animuthyam

Free python dsa course in Telugu

Website link:

Insta:
Engineering Animuthyam

python dsa
dsa python
python in telugu
telugu python
Dsa in telugu
from scratch
easy
hd
simple
telugu engineering
dsa
coding
programming
engineering
engineering animuthyam.
jobs
high paying jobs
road maps
Dsa in telugu
Mern stack
Python
Java
M1
Daa
Placements
Btech
IIt
Nit
Eamcet

#coding #telugu #job #python #telugumemes #trendingreels #btech #college #java #javacoding #iit #pythontutorialtelugu
#nit #jee #eamcet #dsa
Рекомендации по теме
Комментарии
Автор

HI MACHA IT REALLY HELPS ME A LOT AND ALSO IAM PREPARING FOR THE DSA THANK YOU SO MUCH MACHA
HERE IS MY CODE
li=list(map(int, input().split()))
ans=[]
for i in range(len(li)):
for j in range(i+1, len(li)):
if li[i]<li[j]:
ans.append(li[j]-li[i])
else:
continue
print(max(ans) if ans else -1)

GayathriAIML
Автор

Optimal code I get it after 30-40 minutes but I am so happy to get it
a=[1, 5, 2, 10]
n=len(a)
minval=a[0]
ans=-1
for i in range(1, n):
minval=min(minval, a[i])
if minval<a[i]:
temp=a[i]-minval
ans=max(ans, temp)

print(ans)

MounikaVemulapalli-nc
Автор

Videos full chusa macha Explanation chala bagundi macha ❤❤

karthikphotoeditz
Автор

n=[7, 1, 5, 4]
max=0
for i in range(len(n)):
sum=0
for j in range(i+1, len(n)):
sum=n[j]-n[i]
if sum>max:
max=sum
print(max)

studybuddy
Автор

class Solution:
def maximumDifference(self, nums: List[int]) -> int:


a=0
for i in range(len(nums)):
for j in range(1, len(nums)):
if i<j:
b=nums[j]-nums[i]
a=max(a, b)
if a==0:
return -1
else:
return a

gouthamvardhan
Автор

Bro already some code Naku vachhindhi but condition pettale anthe nums=[1, 5, 2, 10]
diffirence=0
for i in range(len(nums)):
for j in range(i+1, len(nums)):
if nums[i]<nums[j]:
diffirence=max(diffirence, nums[j]-nums[i])
print(diffirence)

Villages
Автор

logic think chesthunna macha but raayaleka pothunna any suggestions

Vibe___memess
Автор

n = [3, 4, 5, 8]
for i in range(len(n)):
for j in range(i+1, len(n)):
if i <= 3:
print(i, j)

ganeshk
Автор

Super macha Nuvvu Cheppinatte 15min varaku Aalochincha Vocchindi, Thank You so much Macha✌🙏🙏
m=-1
for i in range(len(nums)):
for j in range(i+1, len(nums)):
if nums[i]<nums[j]:
d=nums[j]-nums[i]
m=max(d, m)
return m

umar
Автор

Enti macha rojuuu oke Tshirt vesukuntunnav
Anyways baga cheputhunnav chala easy ga ardam avuthundi
❤❤❤❤thank you so much

PallaHarshini-kccq
Автор

nums = [9, 4, 3, 2]
minval=nums[0]
ans=0
for i in range(1, len(nums)):
ans=max(ans, (nums[i]-minval))
minval=min(minval, nums[i])
if ans==0:
print("-1")
else:
print(ans)

saicharanvarmaofficial
Автор

class Solution:
def maximumDifference(self, nums: List[int]) -> int:
diff=float("-inf")
m=nums[0]
for i in range(1, len(nums)):
diff =max(diff, nums[i]-m)
m=min(m, nums[i])
if diff <=0:
return -1
else:
return diff

vinnu
Автор

ans=0
k=nums[0]
for i in range(len(nums)):
k=min(k, nums[i])
ans=max(ans, nums[i]-k)
if(ans==0):
return -1
else:
return ans

SnehaArvapally
Автор

def maximumDifference(self, nums: List[int]) -> int:
n=len(nums)
max_f=-1
i=0
for j in range(1, n):
if nums[i]<nums[j]:
temp=nums[j]-nums[i]
max_f=max(max_f, temp)
elif nums[j]<nums[i]:
i=j
return max_f macha nenu optimal ga think chesina finally got it macha oka 30 mins thina chesina macha

Mahxteja
Автор

Brother if you dont mid
Meeru python with dsa enni days lo course complete chedham ani anikuntunaru

I know flow lo velthunaru ani, but just estimattion like 100 days / 50 days cheppagalaru

Thank you so much for providing such a wonderful teaching providing to us

Telugu community really needs a gem like you

YOUTUBER-yktq
Автор

n=len(nums)
maximum_difference=-1
for i in range(n-1, -1, -1):
for j in range(n):
if i > j :
difference = nums[i] - nums[j]
if (difference > 0 and difference > maximum_difference) :
maximum_difference= difference
return maximum_difference

ananthsaigudla
Автор

optimized way
for i in range(len(nums)):
if nums[i] > min_value:
max_diff = max(max_diff, nums[i]-min_value)
min_value = min(min_value, nums[i])
return max_diff

ajayraj
Автор

Hi anna leetcode lo problems slove cheyali ante premium thesukovala free ga cheyalema

moranandini
Автор

class Solution:
def maximumDifference(self, nums: List[int]) -> int:

s = nums[0]
md = 0
for i in range(1, len(nums)):
if nums[i] < s:
s = nums[i]
cd = nums[i] - s
md = max(cd, md)
if md == 0 :
return -1

return md

Maheshkrishna-pb
Автор

class Solution:
def maximumDifference(self, nums: List[int]) -> int:
n=len(nums)
ans= -1
for i in range(1, n-1):
if nums[i]<nums[i+1]:
temp=nums[i+1]-nums[i]
ans=max(ans, temp)
return ans

i tried bayya but 2 test cases e workout ayyayi

geopoliticsandtrader
visit shbcf.ru