Tech Track T1 - T15π»
Open in Telegram
6 278
Subscribers
+1024 hours
+1057 days
+48730 days
Posts Archive
Repost from BIZ & Articulationπ°π
# Python3 code for Maximum size
# square sub-matrix with all 1s
def printMaxSubSquare(M):
R = len(M) # no. of rows in M[][]
C = len(M[0]) # no. of columns in M[][]
S = []
for i in range(R):
temp = []
for j in range(C):
if i==0 or j==0:
temp += M[i][j],
else:
temp += 0,
S += temp,
# here we have set the first row and first column of S same as input matrix, other entries are set to 0
# Update other entries
for i in range(1, R):
for j in range(1, C):
if (M[i][j] == 1):
S[i][j] = min(S[i][j-1], S[i-1][j],
S[i-1][j-1]) + 1
else:
S[i][j] = 0
# Find the maximum entry and
# indices of maximum entry in S[][]
max_of_s = S[0][0]
max_i = 0
max_j = 0
for i in range(R):
for j in range(C):
if (max_of_s < S[i][j]):
max_of_s = S[i][j]
max_i = i
max_j = j
print("Maximum size sub-matrix is: ")
for i in range(max_i, max_i - max_of_s, -1):
for j in range(max_j, max_j - max_of_s, -1):
print (M[i][j], end = " ")
print("")
# Driver Program
M = [[0, 1, 1, 0, 1],
[1, 1, 0, 1, 0],
[0, 1, 1, 1, 0],
[1, 1, 1, 1, 0],
[1, 1, 1, 1, 1],
[0, 0, 0, 0, 0]]
printMaxSubSquare(M)
# Python3 code for Maximum size
# square sub-matrix with all 1s
def printMaxSubSquare(M):
R = len(M) # no. of rows in M[][]
C = len(M[0]) # no. of columns in M[][]
S = []
for i in range(R):
temp = []
for j in range(C):
if i==0 or j==0:
temp += M[i][j],
else:
temp += 0,
S += temp,
# here we have set the first row and first column of S same as input matrix, other entries are set to 0
# Update other entries
for i in range(1, R):
for j in range(1, C):
if (M[i][j] == 1):
S[i][j] = min(S[i][j-1], S[i-1][j],
S[i-1][j-1]) + 1
else:
S[i][j] = 0
# Find the maximum entry and
# indices of maximum entry in S[][]
max_of_s = S[0][0]
max_i = 0
max_j = 0
for i in range(R):
for j in range(C):
if (max_of_s < S[i][j]):
max_of_s = S[i][j]
max_i = i
max_j = j
print("Maximum size sub-matrix is: ")
for i in range(max_i, max_i - max_of_s, -1):
for j in range(max_j, max_j - max_of_s, -1):
print (M[i][j], end = " ")
print("")
# Driver Program
M = [[0, 1, 1, 0, 1],
[1, 1, 0, 1, 0],
[0, 1, 1, 1, 0],
[1, 1, 1, 1, 0],
[1, 1, 1, 1, 1],
[0, 0, 0, 0, 0]]
printMaxSubSquare(M)
Iteration tools
800
Pd.read_csv(get.put(4))
Programming language
Numpy.get_error(50)
Random.randint(100)
Seaborn graph
Pie.plot.append(corner=left)
Combination.itertools(df.scale())
Slot 3 and slot 4 will i cover in this group due to personal reason I'm not covering this slot 2.
TCS DCA python Slot 1 :
@TCS_DIGITAL_UPDATES
Q) you want to open a text file
Ans) r
Q) which command is used to print a text....
Ans) plt.annotate()
Q) you are give a list of cities
Ans) len(cities)
Q) how will you save an array in CSV format
Ans)pd.save_Csv('number.csv',num, delimiter ="\t"
Q) which code snippet would help us
Ans) np.ones(4,4)
Q) order of operations plays a vital role
Ans)((-4)**2)+4
@TCS_DIGITAL_UPDATES
Q) you are doing exploratory analysis
Ans) scatter plot
Q) which command you will use to check the python version
Ans) python -v
Q) A variable named 'savings:
Ans) 800
Q) which keyword we used as a 'no-operation'
Ans)pass
Q) How to write the given function in one line code
Ans) square = [i*i for i in range(10)]
Q) you have data frame of shape (140,10)
Ans) 35,10
Q) There is a special name of function these type...
Ans) Recursive function
Q) what will be the following output code ?
Result = Lambda x,y,z
Ans) 8
Q) In the employees"Performance chart'
Ans) ax.barh(people, performance,xerr = error,align='right'
@TCS_DIGITAL_UPDATES
Q) you are working on the weather forecast data
Ans)6,3
@TCS_DIGITAL_UPDATES
Q) you have been asked to do certain calculations
Ans)pd.to_date('today')-record['year_born]
@TCS_DIGITAL_UPDATES
TCS DCA python Slot 1 :
Q) you want to open a text file
Ans) r
Q) which command is used to print a text....
Ans) plt.annotate()
Q) you are give a list of cities
Ans) len(cities)
Q) how will you save an array in CSV format
Ans)pd.save_Csv('number.csv',num, delimiter ="\t"
Q) which code snippet would help us
Ans) np.ones(4,4)
Q) order of operations plays a vital role
Ans)((-4)**2)+4
Q) you are doing exploratory analysis
Ans) scatter plot
Q) which command you will use to check the python version
Ans) python -v
Q) A variable named 'savings:
Ans) 800
Q) which keyword we used as a 'no-operation'
Ans)pass
Q) How to write the given function in one line code
Ans) square = [i*i for i in range(10)]
ans=10000000
def solve(a, n, k, index, sum, maxsum):
global ans
# K=1 is the base Case
if (k == 1):
maxsum = max(maxsum, sum)
sum = 0
for i in range(index,n):
sum += a[i]
# we update maxsum
maxsum = max(maxsum, sum)
# the answer is stored in ans
ans = min(ans, maxsum)
return
sum = 0
# using for loop to divide the array into
# K-subarray
for i in range(index, n):
sum += a[i]
# for each subarray we calculate sum ans update
# maxsum
maxsum = max(maxsum, sum)
# calling function again
solve(a, n, k - 1, i + 1, sum, maxsum)
# driver code
n=int(input())
k=int(input())
arr=[]
for z in range(n):
arr.append(int(input()))
solve(arr, n, k, 0, 0, 0)
print(ans)
Don't forget to join all my discussion channel β€οΈπ₯π₯π₯ take a moment to read full message ππ
@TCS_DIGITAL_UPDATES
IMPORTANT UPDATE π―π
βοΈTAKE A MOMENT TO READ π FULL MESSAGE
πJOIN THE CORRESPONDING CHANNEL FOR DCA
πFOR PYTHON - @dca_python
πFOR PYTHON CODE- @dca_python_code
πFOR PYTHON AND JAVA DISCUSSION - @dca_python_java
π All WINGS DISCUSSION - @wings_discusions
πADMIN CHANNEL - @biz_skillslots
πDigital channel - @TCS_DIGITAL_UPDATES
FOR REMAINING DCA TECHNOLOGIES ,I WILL COVER IN THIS CHANNEL π
π₯READ DESCRIPTION OF CHANNEL ONCE
π
MY CHANNEL GOT THE PEOPLE CHOICE AWARD
π‘ IF U LOVE MY WORK,PLEASE TAKE A MOMENT TO SHARE MY CHANNEL.π―π
π°NO MORE PRIME SCAM ,THIS IS THE MOTO OF THE CHANNEL
βοΈ KINDLY PIN THIS CHANNEL,SO YOU WONT MISS ANY UPDATE
