From 686e39e8124645113304540ff3f96b8a06aa34ec Mon Sep 17 00:00:00 2001 From: Praneel-Shivarkar Date: Thu, 30 Oct 2025 20:37:57 +0530 Subject: [PATCH 1/6] Added solution for bubblesort in javascript --- javascript/Bubblesort.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 javascript/Bubblesort.js diff --git a/javascript/Bubblesort.js b/javascript/Bubblesort.js new file mode 100644 index 00000000..e69de29b From 4b8aca04b01961d51c040ba2fb8c7a23e156efe9 Mon Sep 17 00:00:00 2001 From: Nandan Acharya Date: Fri, 31 Oct 2025 20:00:40 +0530 Subject: [PATCH 2/6] Create Unique_Paths.py --- Unique_Paths.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Unique_Paths.py diff --git a/Unique_Paths.py b/Unique_Paths.py new file mode 100644 index 00000000..61eca06e --- /dev/null +++ b/Unique_Paths.py @@ -0,0 +1,14 @@ +dp ={} +def uniquePaths(m , n): + if n<1 or m<1: + return 0 + + if m==1 and n==1: + return 1 + + if (n,m) in dp: + return dp[(n,m)] + + dp[(n,m)] = uniquePaths(m-1,n) + uniquePaths(m,n-1) + + return dp[(n,m)] From 2bc51ed808d179a2b5168a480743b6dd8d449d98 Mon Sep 17 00:00:00 2001 From: esachdev28 Date: Fri, 31 Oct 2025 20:21:16 +0530 Subject: [PATCH 3/6] code add --- python/Coin_Change2.py | 0 python/Longest_Increasing_Subsequence.py | 0 python/Save_People.py | 0 python/Unique_Paths.py | 0 4 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 python/Coin_Change2.py create mode 100644 python/Longest_Increasing_Subsequence.py create mode 100644 python/Save_People.py create mode 100644 python/Unique_Paths.py diff --git a/python/Coin_Change2.py b/python/Coin_Change2.py new file mode 100644 index 00000000..e69de29b diff --git a/python/Longest_Increasing_Subsequence.py b/python/Longest_Increasing_Subsequence.py new file mode 100644 index 00000000..e69de29b diff --git a/python/Save_People.py b/python/Save_People.py new file mode 100644 index 00000000..e69de29b diff --git a/python/Unique_Paths.py b/python/Unique_Paths.py new file mode 100644 index 00000000..e69de29b From c9f24fc0eeb6b8fa1f2b6758d8c492fc488f4565 Mon Sep 17 00:00:00 2001 From: sasi-upparapalli Date: Fri, 31 Oct 2025 23:13:15 +0530 Subject: [PATCH 4/6] Add Dijkstra's shortest path algorithm with example and README update --- Algorithms/dijkstra.py | 44 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Algorithms/dijkstra.py diff --git a/Algorithms/dijkstra.py b/Algorithms/dijkstra.py new file mode 100644 index 00000000..08d0a47f --- /dev/null +++ b/Algorithms/dijkstra.py @@ -0,0 +1,44 @@ +import heapq + +def dijkstra(graph, start): + """ + Dijkstra's algorithm to find shortest paths from start node to all other nodes. + + Parameters: + graph : dict - adjacency list {node: [(neighbor, weight), ...]} + start : starting node + + Returns: + distances : dict - shortest distance from start to each node + """ + + distances = {node: float('inf') for node in graph} + distances[start] = 0 + + priority_queue = [(0, start)] # (distance, node) + + while priority_queue: + current_distance, current_node = heapq.heappop(priority_queue) + + if current_distance > distances[current_node]: + continue + + for neighbor, weight in graph[current_node]: + distance = current_distance + weight + + if distance < distances[neighbor]: + distances[neighbor] = distance + heapq.heappush(priority_queue, (distance, neighbor)) + + return distances + +# Example usage: +if __name__ == "__main__": + graph = { + 'A': [('B', 1), ('C', 4)], + 'B': [('A', 1), ('C', 2), ('D', 5)], + 'C': [('A', 4), ('B', 2), ('D', 1)], + 'D': [('B', 5), ('C', 1)] + } + start_node = 'A' + print("Shortest distances:", dijkstra(graph, start_node)) From c71cf03b5f59e71befb330dc1e38434fe0c314cb Mon Sep 17 00:00:00 2001 From: siddhi ranka Date: Mon, 10 Nov 2025 22:39:18 +0530 Subject: [PATCH 5/6] added python code --- .../Longest_Alternating_Even_Odd_Subarray.py | 25 +++++++++++++++++++ python/Sum_of_Unique_Elements.py | 19 ++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 python/Longest_Alternating_Even_Odd_Subarray.py create mode 100644 python/Sum_of_Unique_Elements.py diff --git a/python/Longest_Alternating_Even_Odd_Subarray.py b/python/Longest_Alternating_Even_Odd_Subarray.py new file mode 100644 index 00000000..b2881ba0 --- /dev/null +++ b/python/Longest_Alternating_Even_Odd_Subarray.py @@ -0,0 +1,25 @@ +# Longest_Alternating_Even_Odd_Subarray.py + +def longestAlternatingEvenOdd(arr): + if not arr: + return 0 + + max_len = 1 + curr_len = 1 + + for i in range(1, len(arr)): + # Check alternating condition: + if (arr[i] % 2) != (arr[i-1] % 2): + curr_len += 1 + max_len = max(max_len, curr_len) + else: + curr_len = 1 + + return max_len + + +# Example usage: +if __name__ == "__main__": + nums = [3, 2, 5, 4, 7] + print("Input:", nums) + print("Longest Alternating Even-Odd Subarray Length:", longestAlternatingEvenOdd(nums)) diff --git a/python/Sum_of_Unique_Elements.py b/python/Sum_of_Unique_Elements.py new file mode 100644 index 00000000..92875d6f --- /dev/null +++ b/python/Sum_of_Unique_Elements.py @@ -0,0 +1,19 @@ +# Sum_of_Unique_Elements.py + +def sumOfUnique(nums): + freq = {} + for n in nums: + freq[n] = freq.get(n, 0) + 1 + + total = 0 + for key, val in freq.items(): + if val == 1: + total += key + return total + + +# Example usage +if __name__ == "__main__": + arr = [1, 2, 3, 2] + print("Input:", arr) + print("Sum of Unique Elements:", sumOfUnique(arr)) From 5b4bd991822b98173b2c4e83aa8b36ca8d403da2 Mon Sep 17 00:00:00 2001 From: siddhi ranka Date: Wed, 12 Nov 2025 08:43:51 +0530 Subject: [PATCH 6/6] added --- python/Lonely Number Finder.py | 15 +++++++++++++++ python/Mirror Index Sum.py | 12 ++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 python/Lonely Number Finder.py create mode 100644 python/Mirror Index Sum.py diff --git a/python/Lonely Number Finder.py b/python/Lonely Number Finder.py new file mode 100644 index 00000000..87a784ef --- /dev/null +++ b/python/Lonely Number Finder.py @@ -0,0 +1,15 @@ +def find_lonely(nums): + from collections import Counter + count = Counter(nums) + lonely = [] + + for num in nums: + if count[num] == 1 and count[num - 1] == 0 and count[num + 1] == 0: + lonely.append(num) + + return sorted(lonely) + +# Example runs +print(find_lonely([10, 6, 5, 8])) # Output: [8, 10] +print(find_lonely([1, 3, 5, 3])) # Output: [1, 5] +print(find_lonely([7, 8, 9, 10])) # Output: [] diff --git a/python/Mirror Index Sum.py b/python/Mirror Index Sum.py new file mode 100644 index 00000000..4e6b0bb0 --- /dev/null +++ b/python/Mirror Index Sum.py @@ -0,0 +1,12 @@ +def mirror_index_sum(nums): + total = 0 + n = len(nums) + for i in range(n // 2 + n % 2): + if nums[i] == nums[n - 1 - i]: + total += nums[i] + return total + +# Example runs +print(mirror_index_sum([1, 3, 2, 3, 1])) # Output: 5 +print(mirror_index_sum([2, 5, 5, 2])) # Output: 4 +print(mirror_index_sum([4, 1, 7, 9])) # Output: 0