Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Search element in a matrix
rows = int(input()) columns = int(input()) l = [[int(input()) for x in range (columns)] for y in range(rows)] N = len(l) M = len(l[0]) i=0 j=M-1 search = 3 while(i<=N and j>=0): if(search < l[0][0] or search>l[N-1][M-1]): print("Element not present") break elif(search==l[i][j]): print("Element present at index:",i+1,j+1) break elif(search < l[i][j]): j-=1 elif(search > l[i][j]): i+=1
run
|
edit
|
history
|
help
0
Depth First Search - Find if path exists
list_copy_shallow_deep.py
HW Descending Order Final
Python wtf ?
calucation
string length
Celcius to Fahrenheit
EquivalentRandomDigits
abstractmethod 2
Moore Voting Algorithm