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
xhr = new XMLHttpRequest(); | |
xhr.open("POST", "add_specs/", false); | |
xhr.setRequestHeader("Cache-Control", "no-cache"); | |
xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest"); | |
xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken')); | |
data = JSON.stringify(spec_rows); | |
xhr.send(data); |
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
def removeDuplicates(self, nums:List[int]) -> int: | |
nums.sort() | |
for i in nums: | |
while nums.count(i)>1: | |
nums.remove(i) | |
print(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
def binary_search(a:list,target:int)->str: ##found, notfound | |
if len(a)==0:return "NOT FOUND" | |
a.sort() | |
mid = len(a)//2 | |
if a[mid]== target:return "FOUND" | |
else: | |
if a[mid] < target:return binary_search_re(a[mid+1:],target) | |
if a[mid] > target:return binary_search_re(a[:mid],target) |