Instantly share code, notes, and snippets.

If it's not gonna work,it is worth a try.

# Ayoush Chourasia Ayoush

If it's not gonna work,it is worth a try.
• Pune
Created November 21, 2023 05:54
two sum
View two_sum.py
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(object): def twoSum(self, nums, target): hash_map = {} for i in range(len(nums)): ans = target - nums[i] if ans in hash_map.keys(): return([hash_map[ans], i]) hash_map[nums[i]] = i
Created November 21, 2023 05:26
anagram
View valid_anagram.py
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 isAnagram(s, t): if len(s) != len(t): return False s_hash = [] t_hash = [] for i in range(0, len(s)): if s[i] in t_hash: t_hash.remove(s[i]) else: s_hash = s_hash + [s[i]]
Created November 21, 2023 05:12
contains_duplicate
View contains_duplicate.py
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 containsDuplicate(self, nums): if len(nums) == 1: return False nums.sort() for i in range(1, len(nums)): if nums[i-1] == nums[i]: return True return False
Last active August 25, 2020 05:48
View example.ex
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
 defmodule OtpConceptsProcesses do use GenServer def start_link() do GenServer.start_link(__MODULE__, :ok, []) end def init(:ok) do {:ok, %{}} end
Created February 24, 2020 18:21
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
 Enum.reduce(params, dynamic(true), fn {"workspace_id", workspace_id}, dynamic_query -> dynamic( [task, project, user_task, time_track], ^dynamic_query and project.workspace_id == ^workspace_id ) {"user_ids", user_ids}, dynamic_query -> user_ids = Enum.map(String.split(user_ids, ","), fn x -> String.to_integer(x) end)
Created February 24, 2020 18:00
View example.ex
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
Created January 15, 2016 04:05
View scope.c
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
 int main() { { int x = 10, y = 20; { // The outer block contains declaration of x and y, so // following statement is valid and prints 10 and 20 printf("x = %d, y = %d\n", x, y); { // y is declared again, so outer block y is not accessible
Created January 10, 2016 05:28
View IPCserver.c
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