LeetCode: Isomorphic Strings
Problem: https://leetcode.com/problems/isomorphic-strings/description/ Code: class Solution: def map_check(self, txt1: str,txt2: str, char_map: dict)->bool: for i in range(len(txt1)): if txt1[i] not in char_map: ...
Search for a command to run...
Articles tagged with #coding
Problem: https://leetcode.com/problems/isomorphic-strings/description/ Code: class Solution: def map_check(self, txt1: str,txt2: str, char_map: dict)->bool: for i in range(len(txt1)): if txt1[i] not in char_map: ...
Problem: https://leetcode.com/problems/reverse-bits/description/ Code: class Solution: def reverseBits(self, n: int) -> int: bin_num = format(n, '032b') rev = bin_num[::-1] return int(rev, 2) Key Points: Every input numb...
Problem: https://leetcode.com/problems/row-with-maximum-ones/description/ Code: class Solution: def rowAndMaximumOnes(self, mat: List[List[int]]) -> List[int]: """ Find the row with max ones, if same ones select the one with lower...
Problem: https://leetcode.com/problems/matrix-diagonal-sum/description/ Code: class Solution: def diagonalSum(self, mat: List[List[int]]) -> int: """ Sum of Primary & Seconday elements, not repeating middle element. """ ...
Problem: https://www.geeksforgeeks.org/problems/wave-array-1587115621/1 from typing import List class Solution: def _swap(self, arr: List[int], index: int)->None: """ I just swap two elements. In Place manipulation, no ret...