This file contains hidden or 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
error while running | |
////////// | |
Launching lib\main.dart on Windows in debug mode... | |
Building Windows application... | |
Exception: Build process failed. To view the stack trace, please run `flutter run -d windows -v`. | |
/////////////// | |
run with flutter stack trace |
This file contains hidden or 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
# Definition for singly-linked list. | |
# class ListNode: | |
# def __init__(self, x): | |
# self.val = x | |
# self.next = None | |
class Solution: | |
def middleNode(self, head: ListNode) -> ListNode: | |
fst=head | |
slw=head |
This file contains hidden or 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 getHint(self, secret: str, guess: str) -> str: | |
d = {} | |
bull = 0 | |
cow = 0 | |
for i in range(len(secret)): | |
if (secret[i] == guess[i]): | |
bull += 1 | |
else: | |
if (secret[i] in d): |
This file contains hidden or 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 hasAlternatingBits(self, n: int) -> bool: | |
st='' | |
while(n>0): | |
st+=str(n%2) | |
n=n//2 | |
for i in range(len(st)-1): | |
if(st[i]==st[i+1]): | |
return False | |
else: |
This file contains hidden or 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
#program is not 100% correct faling in some test cases. | |
# i am working on it and efficiency can also be increased | |
class Solution: | |
def isIsomorphic(self, s, t): | |
d = {} | |
if(s==t): | |
return True | |
else: | |
for i in range(len(s)): |
This file contains hidden or 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
1 | |
10 | |
A 10 | |
A 15 | |
A 20 | |
I 10 | |
A 22 | |
D 5 | |
A 27 | |
P 3 |
This file contains hidden or 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
# Definition for a binary tree node. | |
# class TreeNode: | |
# def __init__(self, x): | |
# self.val = x | |
# self.left = None | |
# self.right = None | |
class Solution: |
This file contains hidden or 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 hasGroupsSizeX(self, deck) -> bool: | |
d = {} | |
for i in range(len(deck)): | |
if (deck[i] in d): | |
d[deck[i]] += 1 | |
else: | |
d[deck[i]] = 1 | |
print(d) | |
for x in range(2, len(deck) + 1): |
This file contains hidden or 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 dominantIndex(self, nums) -> int: | |
m=max(nums) | |
print(m) | |
m_index=nums.index(m) | |
for i in range(len(nums)): | |
if(nums[i]==0 or nums[i]==m): | |
pass | |
elif(m//nums[i]<2): | |
return -1 |
This file contains hidden or 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
lst=[1,2,3,4] | |
lst1=[] | |
lst1.append([]) | |
for i in range(len(lst)): | |
tmp_lst=[] | |
for j in range(i+1,len(lst)+1): | |
tmp_lst=lst[i:j] | |
lst1.append(tmp_lst) | |
print(lst1) |
NewerOlder