This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution: | |
def getConcatenation(self, nums: List[int]) -> List[int]: | |
for i in range(len(nums)): | |
nums.append(nums[i]) | |
return nums |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution: | |
def maximumWealth(self, accounts: List[List[int]]) -> int: | |
for i in range(0, len(accounts)): | |
accounts[i] = sum(accounts[i]) | |
return max(accounts) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution: | |
def runningSum(self, nums: List[int]) -> List[int]: | |
Sum = 0 | |
for i in range(0,len(nums)): | |
Sum = Sum + nums[i] | |
nums[i] = Sum | |
return nums |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution: | |
def twoSum(self, nums: List[int], target: int) -> List[int]: | |
a = [() for i in range(2)] | |
for i in range(0,len(nums)): | |
for j in range(i+1,len(nums)): | |
if target == nums[i]+nums[j]: | |
return [i,j] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
par = input() | |
list = [] | |
invalid = 0 | |
for i in range(len(par)): | |
if par[i] == '(': | |
list.append(par[i]) | |
elif par[i] == ')': | |
if len(list) == 0: | |
invalid = invalid + 1 | |
else: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stri,n = input().split() | |
n = int(n) | |
print(stri) | |
def fun(init): | |
stri = "" | |
i = 0 | |
while i < len(init): | |
j = i + 1 | |
count = 1 | |
while j <= len(init)-1 : |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
arr = [int(x) for x in input().split()] | |
res=[] | |
def multiply(lst): | |
j = 1 | |
for i in range(len(lst)): | |
j = j * lst[i] | |
return j | |
def product(arr,k,p): | |
arr[i]=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
power=[] | |
klist=[] | |
def pokemon(q): | |
for j in range(q): | |
z, y = input().split() | |
y=int(y) | |
if z=='a': | |
power.append(y) | |
elif z=='i': | |
for s in range(len(power)): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
flist=[] | |
slist=[] | |
count = 0 | |
A=[int(x) for x in input().split()] | |
target = int(input()) | |
for x in range(len(A)) : | |
if target == A[x] : | |
flist.append(x) | |
count+=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
t = [int(x) for x in input().split()] | |
if len(t) < 3 : | |
print(False) | |
sys.exit() | |
for i in range(len(t)): | |
for j in range(i+1,len(t)): | |
for k in range(j+1,len(t)): | |
if ((t[i]**2)+(t[j]**2)) == (t[k]**2): |
NewerOlder