├── .vscode └── settings.json ├── 0_1_Knapsack_Problem.md ├── 20.c ├── 2D transformation.C ├── AREA_OF_A_CIRCLE.c ├── AVL_Tree.c ├── Advanced Calculator using C.c ├── Android Number Guess Game ├── app │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ ├── androidTest │ │ └── java │ │ │ └── com │ │ │ └── example │ │ │ └── sanan │ │ │ └── guessnumber │ │ │ └── ExampleInstrumentedTest.java │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── ic_launcher-web.png │ │ ├── java │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── sanan │ │ │ │ └── guessnumber │ │ │ │ └── MainActivity.java │ │ └── res │ │ │ ├── drawable-mdpi │ │ │ ├── dice_five.PNG │ │ │ ├── dice_four.PNG │ │ │ ├── dice_one.png │ │ │ ├── dice_six.PNG │ │ │ ├── dice_three.PNG │ │ │ └── dice_two.PNG │ │ │ ├── drawable-v24 │ │ │ └── ic_launcher_foreground.xml │ │ │ ├── drawable │ │ │ └── ic_launcher_background.xml │ │ │ ├── layout │ │ │ └── activity_main.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── d2s.png │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_foreground.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_foreground.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_foreground.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_foreground.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_foreground.png │ │ │ └── ic_launcher_round.png │ │ │ └── values │ │ │ ├── colors.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ │ └── test │ │ └── java │ │ └── com │ │ └── example │ │ └── sanan │ │ └── guessnumber │ │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle ├── Armstrong.c ├── Armstrong.cpp ├── Array.c ├── AstarSearchAlgo.java ├── Athlete Sort in python.py ├── Avoid Deadlock ├── BellmanFord.cpp ├── Binary Number to Octal vice-versa.c ├── Binary Search.cpp ├── BinnerySerch.py ├── Binomial Coefficient ├── Black cells in a chessboard.cpp ├── BlowfishAlgorithm.py ├── BottomUp_Cut_Rod.cpp ├── Breadth First Search (Linked List).ipynb ├── Bubble sort CPP.cpp ├── BubbleSort.js ├── Bubble_Sort.C ├── BucketSort.c ├── BuckleSort.java ├── C ├── C++ ├── 0_1_knapsack.cpp ├── AllSearchingAlgorithm.cpp ├── Bubble Sort.cpp ├── BubbleSort.cpp ├── BucketSort.cpp ├── Butterfly pattern ├── Create StacksUsingLinkedList.cpp ├── CyclicSort.cpp ├── DDA.cpp ├── DfsIterative.cpp ├── FibonacciSearch.cpp ├── HeapSort.cpp ├── Inc-Dec.cpp ├── Infix_To_Postfix.cpp ├── InsertionSort.cpp ├── Kickstart(round G).cpp ├── LCM.cpp ├── Large_Factorial.cpp ├── Longest_increasing_subsequence.cpp ├── Merge Sorted Array.cpp ├── MergeSort.cpp ├── PalindromeNumbers.cpp ├── Pascal_Triangle.cpp ├── Pigeonhole Sort.cpp ├── PrintPyramid.cpp ├── Prod_arr_exce_self.cpp ├── Quardratic.cpp ├── QuickSort.cpp ├── RadixSort.cpp ├── ReverseArray.cpp ├── ReverseLL ├── SelectionSort.cpp ├── ShellSort.cpp ├── Shortest Safe Route In A Field With Landmines.cpp ├── Snake Game.cpp ├── Spiral Matrix.cpp ├── Spiral_Matrix.cpp ├── Sum of Two Arrays.cpp ├── Timsort.cpp ├── Transpose of a Matrix.cpp ├── addsubmatrix.cpp ├── binary_search_tree.cpp ├── bloom_filters.cpp ├── connected_component.cpp ├── countSort.c ├── dnfSort.cpp ├── golomb_sequence.cpp ├── insert_node_at_a_specific_pos_in_a_linkedlist.cpp ├── insertion_in_BST.cpp ├── leap year or not.cpp ├── longest_common_subsequence(lcs).cpp ├── longest_valid_parenthesis.cpp ├── nextgreaterelement.cpp ├── odd and even.exe ├── oppoverload.cpp ├── partition_equal_subset_sum.cpp ├── prime_number.cpp ├── product-array-except-self.cpp ├── shell_sort.cpp └── subset_sum_problem.cpp ├── CF_Omkar_and_Heavenly_Tree.cpp ├── Calculator.c ├── CalculatorGUI.py ├── Calendar ├── Catlan_Numbers.c ├── Change BG Color HTML CSS JS ├── index.html ├── main.js └── style.css ├── CharCaseCheck.java ├── Check Whether a Character is a Vowel or Consonant.c ├── Check Whether a Number is Positive or Negative.c ├── CheckArmstrongNO.cpp ├── Check_if_a_queue_can_be_sorted_into_another_queue_using_a_stack.cpp ├── Circular Singly Linked List Operations.c ├── CodeChef Snack Down 2021 Qualifiers ├── Compute Quotient and Remainder.c ├── Count number of ways to cover a distance ├── Count ways to build street under given constraints ├── CountingSort.c ├── Cpu_Schudling.c ├── DEQueue.c ├── DFS without using visited array.cpp ├── DOUBLELI.C ├── Decimal to Binary.java ├── Detec_Cycle_using_DFS.cpp ├── Detect_Loop_Using_Floyd’s Cycle-Finding Algorithm.cpp ├── DiamondShape.java ├── Dice-Stimulator.py ├── Different ways to sum n using numbers greater than or equal to m ├── Digit_Frequency_Calculator.c ├── Dijkstra_algo.java ├── Dijkstra’s algo ├── Dijsktra.java ├── Display Fibonacci Series.cpp ├── Doubly Linked List ├── DLinkedList.class ├── DLinkedList.java ├── Node.class ├── Two pointers │ ├── DLinkedList.class │ ├── DLinkedList.java │ ├── Node.class │ ├── testDLinkedList.class │ └── testDLinkedList.java ├── testDLinkedList.class └── testDLinkedList.java ├── DoublyEndedQ.c ├── EmployeeDetails.java ├── Encryption and Decryption ├── decrypt.c └── encrypt.c ├── EqualStacks.java ├── FCFS Scheduling Operating System ├── Factorial.cpp ├── Fibonacci series using recursion ├── Fibonacci series using recursion.cpp ├── Fighting Game Py ├── index.pyw └── settings.txt ├── Find All Roots of a Quadratic Equation.cpp ├── Find Quotient and Remainder.cpp ├── Find n-th element from Stern’s Diatomic Series ├── FindingDory.java ├── Floor of an element in sorted array.cpp ├── For mounting google drive in colab code.py ├── Fun.java ├── FuntionsandTernary.c ├── GREEDY ├── EASY │ ├── Fact Digit Sum - EASY.cpp │ ├── Hungry Pizza Lovers - EASY.cpp │ ├── Largest number possible - EASY.cpp │ ├── Largest number with given sum - EASY.cpp │ ├── Majority Element - EASY.cpp │ ├── Maximize Toys - EASY.cpp │ ├── Maximum sum of increasing order elements from n arrays - EASY.cpp │ ├── N meetings in one room - EASY.cpp │ └── Smallest number - BASIC.cpp └── MED │ ├── Activity_Selection_Greedy_algo.c │ ├── Fractional Knapsack - MED.cpp │ ├── Huffman_coding.cpp │ ├── Job Sequencing Problem - MED.cpp │ └── Minimum Platforms - MED.cpp ├── GUI cal.py ├── GUI-Calculator.java ├── Get-Highest-Number.c ├── Gouravmoonka.md ├── HANGMAN_GAME.py ├── HEIGHTOFTHEBINARYTREE.PY ├── Hailstone Sequence.java ├── Haversine.java ├── Heapsort.c ├── Hearts.cpp ├── Height_Of_Tree.cpp ├── HelloWorld.c ├── HelloWorld.java ├── HuffmanCoding.cpp ├── InsertionSortInPython.py ├── Insertion_Sort.cpp ├── Java Data structures ├── queue │ ├── ArrayQueue.java │ ├── LinkedQueue.java │ └── Queue.java └── stack │ ├── ArrayStack.java │ ├── LinkedStack.java │ └── Stack.java ├── Java ├── 26. RemoveDuplicatesfromSortedArray.java ├── 27. RemoveElement.java ├── Palindrome.java ├── Stacks │ ├── MainStack.java │ └── StackX.java └── heapSort ├── KMP algo ├── KadaneAlgo.java ├── Kamlesh-Pendurkar.md ├── KaratsubaAlgor.java ├── Keyboard Piano Project ├── Resource │ ├── Drum │ │ ├── 1.mp3 │ │ ├── 1.wav │ │ ├── 2.mp3 │ │ ├── 2.wav │ │ ├── 3.mp3 │ │ ├── 3.wav │ │ ├── 4.mp3 │ │ └── 4.wav │ ├── Flute │ │ ├── 1.mp3 │ │ ├── 1.wav │ │ ├── 2.mp3 │ │ └── 2.wav │ ├── Guitar │ │ ├── 1.wav │ │ ├── 10.mp3 │ │ ├── 10.wav │ │ ├── 2.mp3 │ │ ├── 2.wav │ │ ├── 3.mp3 │ │ ├── 3.wav │ │ ├── 4.mp3 │ │ ├── 4.wav │ │ ├── 5.mp3 │ │ ├── 5.wav │ │ ├── 6.mp3 │ │ ├── 6.wav │ │ ├── 7.mp3 │ │ ├── 7.wav │ │ ├── 8.mp3 │ │ ├── 8.wav │ │ ├── 9.mp3 │ │ └── 9.wav │ └── sounds │ │ ├── 1.mp3 │ │ ├── 2.mp3 │ │ ├── 3.mp3 │ │ └── 4.mp3 ├── index.html ├── style.css └── working.js ├── Krushkal_algo.c ├── KthGrammar.cpp ├── LICENSE ├── LINKLIST.C ├── Lapindromes.cpp ├── LargestSumContiguousSubarray ├── Leap year program in C ├── Leetcode.cpp ├── Link.dart ├── LinkList.c ├── Linked List implementation in C ├── LinkedListDemo.java ├── LinkedList_singlenode.cpp ├── List.c ├── MENU.PY ├── Mahasena_Codechef_solution.cpp ├── Majority_element.cpp ├── Max Difference You Can Get From Changing an Integer.cpp ├── MaxMin.cpp ├── Maximize the sum of selected numbers from an array to make it empty ├── Maximum element in array.cpp ├── MeanMedianMode.cpp ├── Mergesort.c ├── MinMaxElementFinder ├── Minesweeper ├── app.js ├── index.html └── style.css ├── Momos market ├── Momos market.cpp ├── Money-hello.c ├── Movie Ticket Booking System Using C++.cpp ├── Multiplayer_Tic-Tac-Toe_game_using_c.c ├── MyFirstApplication ├── .gitignore ├── .idea │ ├── .name │ ├── codeStyles │ │ └── Project.xml │ ├── gradle.xml │ ├── jarRepositories.xml │ ├── misc.xml │ └── runConfigurations.xml ├── app │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ ├── androidTest │ │ └── java │ │ │ └── com │ │ │ └── example │ │ │ └── myfirstapplication │ │ │ └── ExampleInstrumentedTest.java │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── myfirstapplication │ │ │ │ ├── InfoActivity.java │ │ │ │ ├── MainActivity.java │ │ │ │ ├── SignupActivity.java │ │ │ │ ├── data │ │ │ │ ├── LoginDataSource.java │ │ │ │ ├── LoginRepository.java │ │ │ │ ├── Result.java │ │ │ │ └── model │ │ │ │ │ └── LoggedInUser.java │ │ │ │ └── ui │ │ │ │ └── login │ │ │ │ ├── LoggedInUserView.java │ │ │ │ ├── LoginActivity.java │ │ │ │ ├── LoginFormState.java │ │ │ │ ├── LoginResult.java │ │ │ │ ├── LoginViewModel.java │ │ │ │ └── LoginViewModelFactory.java │ │ └── res │ │ │ ├── drawable-v24 │ │ │ └── ic_launcher_foreground.xml │ │ │ ├── drawable │ │ │ └── ic_launcher_background.xml │ │ │ ├── layout │ │ │ ├── activity_info.xml │ │ │ ├── activity_login.xml │ │ │ ├── activity_main.xml │ │ │ └── activity_signup.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ └── values │ │ │ ├── colors.xml │ │ │ ├── dimens.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ │ └── test │ │ └── java │ │ └── com │ │ └── example │ │ └── myfirstapplication │ │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle ├── Nth prime number.c ├── Octogan.cpp ├── Os Handling using python ├── POW(x,n) USING java ├── Pacman ├── Palindrom_finder.c ├── PancakeSort.cpp ├── Payment_form.html ├── PetersonNumber.java ├── PrimAlgo.cpp ├── Prime number or not.cpp ├── Prime-number.c ├── Prims_algo.java ├── Productofarrayexceptitself.cpp ├── Program to Store and Display Information Using Structure ├── Pyramid.c ├── Pyramid_patern.cpp ├── PythonBasedDictionaryApp ├── app1.py └── data.json ├── Queue.cpp ├── Quick Sort ├── QuickSort.java ├── QuickSort.py ├── README.md ├── RSA_Algorithm ├── Radix - sort ├── Random List generator Python.py ├── Redblack_tree.c ├── Reverse_prefix.cpp ├── Reversing LinkedList(iterative).cpp ├── ReversingKNodes.cpp ├── STL └── array.cpp ├── Scheduling Algorithm └── ShortestJobFirst(SJF).cpp ├── SelectionSortInPython ├── Selection_sort.c ├── Sjf.c ├── Snake_pattern.c ├── Sorting Algorithms Using C ├── BogoSort.c ├── Bubble sort using C.txt ├── Circular Queue using C.txt ├── CycleSort.c ├── HeapSort.c ├── Insertion sort using C.txt ├── Merge Sort using C.txt ├── Quick Sort using C.txt ├── RadixSort.c ├── Selection sort using C.txt ├── ShellSort.c ├── Tower of Hanoi using C.txt ├── counting_sort.c ├── insertion_sort.c ├── mergesort.c ├── mergesort2.c └── quicksort.c ├── Sovam ├── 1.png ├── 2.png ├── 3.svg ├── 4.jpg ├── 4.png ├── Index.html ├── cast.jpg ├── cast.png └── change.png ├── Space Invaders ├── Missle_Launch-Kibblesbob-2118796725.mp3 ├── Missle_Launch-Kibblesbob-2118796725.wav ├── Scary Scream-SoundBible.com-1115384336.mp3 ├── Yellow Rabbit - Personal Use.otf ├── Yellow-Rabbit.png ├── alien.png ├── back.jpg ├── background_music.wav ├── bullet.png ├── death.png ├── explosion.wav ├── fire_sound.wav ├── rocket image.png └── space_invaders.py ├── SparseAddition.c ├── SpiralPrintMatrix.c ├── Splash screen.dart ├── Stack_Queue.ipynb ├── Storagegiropops.c ├── String_Reversal ├── Sublist_search_python ├── Sum of array elements.cpp ├── Swap Two Numbers.cpp ├── Swap two numbers without using a third variable.cpp ├── Swap_word.c ├── Swaptwonumber.c ├── TCS_Digital pipequestion.cpp ├── Table.cpp ├── Table.html ├── Table_Program ├── Task 1_Stock Prediction.ipynb ├── TernarySearch.cpp ├── Themes.dart ├── Tic Tac Toe.py ├── Tic_tac_toe.py ├── To find Prime number using python ├── To_change_an_Expression_from_Infix_to_Postfix.c ├── Tower_of_Hanoi.py ├── TrappingRainWater.cpp ├── Travelling Salesman Problem.c ├── Tree Transversal ├── Tree Traversal.py ├── Ugly Numbers ├── Voice based Project .py ├── Xor.py ├── advancedcalculator.py ├── amstrongnumber.c ├── anagram.cpp ├── anagram_sub_string.js ├── anusha_hashing.cpp ├── arithmetic_kushagra.cpp ├── armstrong_number.c ├── atm.c ├── aws event source mapping ├── balanced binary search tree from array.cpp ├── binary search with recursion.py ├── binary-list-generator.py ├── binaryEquivalent.c ├── binarySearch.java ├── binary_bucket_sort.py ├── binary_search.c ├── binary_tree.cpp ├── binarysearch.java ├── bubble-sort.cpp ├── bucket_sort.c ├── c++ problems asked in interview ├── 1. Two Sum.cpp ├── 101. Symmetric Tree.cpp ├── 102. Binary Tree Level Order Traversal.cpp ├── 104. Maximum Depth of Binary Tree.cpp ├── 11. Container With Most Water.cpp ├── 112. Path Sum.cpp ├── 1137. N-th Tribonacci Number.cpp ├── 1161. Maximum Level Sum of a Binary Tree.cpp ├── 118. Pascal's Triangle.cpp ├── 121. Best Time to Buy and Sell Stock.cpp ├── 141. Linked List Cycle.cpp ├── 144. Binary Tree Preorder Traversal.cpp ├── 145. Binary Tree Postorder Traversal.cpp ├── 1480. Running Sum of 1d Array.cpp ├── 15. 3Sum.cpp ├── 1528. Shuffle String.cpp ├── 20. Valid Parentheses.cpp ├── 203. Remove Linked List Elements.cpp ├── 206. Reverse Linked List.cpp ├── 21. Merge Two Sorted Lists.cpp ├── 215. Kth Largest Element in an Array.cpp ├── 217. Contains Duplicate.cpp ├── 226. Invert Binary Tree.cpp ├── 232. Implement Queue using Stacks.cpp ├── 242. Valid Anagram.cpp ├── 268. Missing Number.cpp ├── 278. First Bad Version.cpp ├── 31. Next Permutation.cpp ├── 35. Search Insert Position.cpp ├── 350. Intersection of Two Arrays II.cpp ├── 36. Valid Sudoku.cpp ├── 374. Guess Number Higher or Lower.cpp ├── 383. Ransom Note.cpp ├── 387. First Unique Character in a String.cpp ├── 41. First Missing Positive.cpp ├── 503. Next Greater Element II.cpp ├── 509. Fibonacci Number(Leetcode).cpp ├── 509. Fibonacci Number.cpp ├── 53. Maximum Subarray.cpp ├── 566. Reshape the Matrix.cpp ├── 69. Sqrt(x).cpp ├── 700. Search in a Binary Search Tree.cpp ├── 701. Insert into a Binary Search Tree.cpp ├── 704. Binary Search.cpp ├── 74. Search a 2D Matrix.cpp ├── 83. Remove Duplicates from Sorted List.cpp ├── 88. Merge Sorted Array.cpp ├── 94. Binary Tree Inorder Traversal.cpp ├── Binary Search(GFG).cpp ├── CODEONFEST-Program - Shortcut.lnk ├── Check set bits(GFG).cpp ├── Count Leaves in Binary Tree(GFG).cpp ├── Generate Binary Numbers (GFG).cpp ├── Half N by M(GFG).cpp ├── K largest elements(GFG).cpp ├── Minimum difference pair (GFG).cpp ├── Number of subsets with product less than k (GFG).cpp ├── Print first letter of every word in the string (GFG).cpp ├── README.md ├── Remove character (GFG).cpp ├── Rotate Array(GFG).cpp ├── Set bits in N equals to M in the given range.cpp └── Snakes and Ladders.cpp ├── cab booking system.cbp ├── cal.html ├── calculator.cpp ├── calculator.py ├── calculator_base_convertor.java ├── calculator_menu.cpp ├── ccatch ├── checkprimenumberthruloop.c ├── chess.py ├── cocktailSearch.cpp ├── coloumnar_cipher ├── comments_and_escape_statements.py ├── container_with_most_water.py ├── countnode operation.cpp ├── css box model ├── css part └── style1.css ├── decode_array.cpp ├── deleteAnElementinAnArray.c ├── depthFirstSearch.java ├── detectCycle.cpp ├── dheer.java ├── djikstra algo.c ├── doubly_linkedlist.cpp ├── drinkspicker.cpp ├── euler_phi_function.cpp ├── evaluate_postfix_expression.cpp ├── evaluating a postfix expression using stack ├── factorial.c ├── factorial.exe ├── factorial_recursion.c ├── fibonacci series ├── fibonacci.cpp ├── first.cpp ├── ford_fulkerson_max_flow.py ├── framediv.html ├── framerec.html ├── ftdm.c ├── function.java ├── game.cpp ├── gcd of 2 numbers ├── generictree.java ├── genetic_algorithm_example.ipynb ├── graph.c ├── hactober.exe ├── hangman ├── images │ ├── hangman0.png │ ├── hangman1.png │ ├── hangman2.png │ ├── hangman3.png │ ├── hangman4.png │ ├── hangman5.png │ └── hangman6.png └── main.py ├── hashing_linear_probing.c ├── hello-world.kt ├── hello-world.py ├── helloworld.py ├── hgdf ├── index.html ├── insertionSort.c ├── interfaz.py ├── intro.c ├── intro.cpp ├── join_two_strings.c ├── kadane_segment_tree.cpp ├── kernel_who.c ├── kruskal_mst.cpp ├── largest_repeating_subsequence.cpp ├── lca.cpp ├── lcqs.java ├── linear_search.c ├── linearsearch.cpp ├── linkedList.c ├── longest_common_subsequence.cpp ├── magic.c ├── main.py ├── mainfile ├── matrix multiplication.py ├── matrix-add.c.c ├── matrix_exponentation.cpp ├── matrixmultiplication.c ├── matrixmultplication.c ├── max2darrayidx.cpp ├── media ├── abstract_17.jpg ├── bubble.png └── wings 2 icon.ico ├── merge sort.cpp ├── mergeTwoArrays.java ├── merge_sort.py ├── mergesort ├── method.java ├── minimizeHeight.cpp ├── minimum.c ├── monopoly_banker.go ├── month&days.c ├── multiplication_matrix.c ├── negativeCycleFinding.cpp ├── new numbers ├── new.java ├── nonprefcfs.c ├── notched bottom navigation bar.dart ├── nth Catalan Number ├── number guesser game.py ├── number_of_set_bits.cpp ├── pacman.py ├── paging.c ├── palindrome-kotlin.kt ├── palindrome.c ├── parser_in_c.c ├── partitioning problem ├── ping pong ├── ball.py ├── main.py ├── paddle.py └── scoreboard.py ├── playfair-cipher.py ├── playfair_cipher.py ├── pointer.c ├── primeNum.c ├── print.py ├── push_pop.c ├── pythonBlAckJacK ├── quiz.py ├── radix_sort.c ├── rainbow.c ├── reciprocal.c ├── reciprocal.exe ├── remove_element.py ├── rest_api_todolist.js ├── reverse-number.c.c ├── reverseList.cpp ├── reverseNumber.py ├── rock_paper_scissors.py ├── rotate_bits.cpp ├── search_linear.js ├── second_large.c ├── selectionSort.py ├── sim.java ├── simplevm.c ├── sizeof the tree.cpp ├── sjf ├── snake.py ├── snake_game.py ├── snakegame.py ├── sorting_the_elements.c ├── speedtest.py ├── spiral_matrix.cpp ├── spiralpattern.cpp ├── stack.h ├── starpyramid.c ├── string_length.c ├── string_reverse.cpp ├── student record.c ├── sum of natural number ├── sum-rc-matrix.c ├── sumOfLastFourDigits.c ├── sum_of_natural_numbers_using_recursion.c ├── swaptwonumbers ├── text-to-speech ├── threeboxes.cpp ├── timsort.py ├── topo sort.cp ├── tower_of_hanoi.c ├── trace of matrix.c ├── transpose.c ├── transpose_of_a_matrix.cpp ├── travel seeker └── travel seeker │ ├── Img │ └── trans_blue-tick.png │ ├── OTP.css │ ├── OTP.html │ ├── Payment.css │ ├── Payment.html │ ├── Payment.js │ ├── README.md │ ├── components │ ├── footer.css │ ├── footer.js │ ├── footer.text │ ├── navbar.css │ ├── navbar.js │ └── navbar.text │ ├── footer_1.css │ ├── forfootermahima.js │ ├── hotelDetails.html │ ├── hotelList.html │ ├── hotelList.js │ ├── images │ ├── Screenshot 2023-04-12 151545.png │ ├── Screenshot 2023-04-12 151745.png │ └── image1.png │ ├── index.css │ ├── index.html │ ├── index.js │ ├── login.html │ ├── login2.html │ ├── navbar_1.css │ ├── scripts │ ├── fornavbar.js │ └── hotelDetails.js │ ├── signUp.html │ └── styles │ └── hotelDetails.css ├── tree_traversals.c ├── value_of_pi.py └── whichmix.cpp /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.associations": { 3 | "HelloWorls.C": "cpp" 4 | } 5 | } -------------------------------------------------------------------------------- /0_1_Knapsack_Problem.md: -------------------------------------------------------------------------------- 1 | 0-1 Knapsack Problem 2 | 3 | How to solve the Knapsack Problem with dynamic programming 4 | 5 | Link : 6 | 7 | https://medium.com/@fabianterh/how-to-solve-the-knapsack-problem-with-dynamic-programming-eb88c706d3cf 8 | -------------------------------------------------------------------------------- /20.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | 4 | void main() 5 | { 6 | int n,i,j; 7 | printf("\nenter the range of the pattern you want to print:"); 8 | scanf("%d", &n); 9 | 10 | 11 | printf("\n\n The pattern that will be displayed is:\n"); 12 | int len = n*2 - 1; 13 | for(i=0;i 2 | //AREA OF A CIRCLE 3 | int main() { 4 | float r; 5 | printf("REDIUS:-"); 6 | scanf("%f", &r); 7 | printf("AREA - %f", 3.14 * r * r ); 8 | return 0; 9 | } -------------------------------------------------------------------------------- /Android Number Guess Game/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /Android Number Guess Game/app/src/androidTest/java/com/example/sanan/guessnumber/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.example.sanan.guessnumber; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.example.sanan.guessnumber", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Android Number Guess Game/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /Android Number Guess Game/app/src/main/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Android Number Guess Game/app/src/main/ic_launcher-web.png -------------------------------------------------------------------------------- /Android Number Guess Game/app/src/main/res/drawable-mdpi/dice_five.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Android Number Guess Game/app/src/main/res/drawable-mdpi/dice_five.PNG -------------------------------------------------------------------------------- /Android Number Guess Game/app/src/main/res/drawable-mdpi/dice_four.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Android Number Guess Game/app/src/main/res/drawable-mdpi/dice_four.PNG -------------------------------------------------------------------------------- /Android Number Guess Game/app/src/main/res/drawable-mdpi/dice_one.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Android Number Guess Game/app/src/main/res/drawable-mdpi/dice_one.png -------------------------------------------------------------------------------- /Android Number Guess Game/app/src/main/res/drawable-mdpi/dice_six.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Android Number Guess Game/app/src/main/res/drawable-mdpi/dice_six.PNG -------------------------------------------------------------------------------- /Android Number Guess Game/app/src/main/res/drawable-mdpi/dice_three.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Android Number Guess Game/app/src/main/res/drawable-mdpi/dice_three.PNG -------------------------------------------------------------------------------- /Android Number Guess Game/app/src/main/res/drawable-mdpi/dice_two.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Android Number Guess Game/app/src/main/res/drawable-mdpi/dice_two.PNG -------------------------------------------------------------------------------- /Android Number Guess Game/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Android Number Guess Game/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Android Number Guess Game/app/src/main/res/mipmap-hdpi/d2s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Android Number Guess Game/app/src/main/res/mipmap-hdpi/d2s.png -------------------------------------------------------------------------------- /Android Number Guess Game/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Android Number Guess Game/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /Android Number Guess Game/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Android Number Guess Game/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /Android Number Guess Game/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Android Number Guess Game/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /Android Number Guess Game/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Android Number Guess Game/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /Android Number Guess Game/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Android Number Guess Game/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /Android Number Guess Game/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Android Number Guess Game/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /Android Number Guess Game/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Android Number Guess Game/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /Android Number Guess Game/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Android Number Guess Game/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /Android Number Guess Game/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Android Number Guess Game/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /Android Number Guess Game/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Android Number Guess Game/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /Android Number Guess Game/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Android Number Guess Game/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /Android Number Guess Game/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Android Number Guess Game/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /Android Number Guess Game/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Android Number Guess Game/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /Android Number Guess Game/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Android Number Guess Game/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /Android Number Guess Game/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Android Number Guess Game/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /Android Number Guess Game/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /Android Number Guess Game/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Guess Number Game 3 | Welcome to Number Guess Game! 4 | Enter a Number(1 to 6 ) 5 | Enter Number 6 | Roll to Guess 7 | 8 | -------------------------------------------------------------------------------- /Android Number Guess Game/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Android Number Guess Game/app/src/test/java/com/example/sanan/guessnumber/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.example.sanan.guessnumber; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /Android Number Guess Game/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | 5 | repositories { 6 | google() 7 | jcenter() 8 | } 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:3.0.1' 11 | 12 | 13 | // NOTE: Do not place your application dependencies here; they belong 14 | // in the individual module build.gradle files 15 | } 16 | } 17 | 18 | allprojects { 19 | repositories { 20 | google() 21 | jcenter() 22 | } 23 | } 24 | 25 | task clean(type: Delete) { 26 | delete rootProject.buildDir 27 | } 28 | -------------------------------------------------------------------------------- /Android Number Guess Game/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /Android Number Guess Game/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Android Number Guess Game/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /Android Number Guess Game/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sun Oct 07 17:53:33 PKT 2018 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip 7 | -------------------------------------------------------------------------------- /Android Number Guess Game/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /Armstrong.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | int main() { 4 | int n,d=0,r,s=0,t; 5 | printf("Enter a no- "); 6 | scanf("%d",&n); 7 | t=n; 8 | while (n>0) 9 | { 10 | n=n/10; 11 | d=d+1; 12 | } n=t; 13 | while (n>0) 14 | { 15 | r=n%10; 16 | printf("%d", d); 17 | s=s+pow(r,d); 18 | n=n/10; 19 | } n=t; 20 | if (n==s) 21 | { 22 | printf("in %d is Armstrong",n); 23 | } else 24 | printf("in %d is not Armstrong",n); 25 | } -------------------------------------------------------------------------------- /Armstrong.cpp: -------------------------------------------------------------------------------- 1 | /* PROGRAM AUTHOR : SAYANTAN BOSE 2 | PROGRAM DETAILS : Armstrong number is a number that is equal to the sum of cubes of its digits. For example 0, 1, 153, 370, 371 and 407 are the Armstrong numbers. 3 | */ 4 | #include 5 | using namespace std; 6 | 7 | int main() { 8 | int num, originalNum, remainder, result = 0; 9 | cout << "Enter a three-digit integer: "; 10 | cin >> num; 11 | originalNum = num; 12 | 13 | while (originalNum != 0) { 14 | // remainder contains the last digit 15 | remainder = originalNum % 10; 16 | 17 | result += remainder * remainder * remainder; 18 | 19 | // removing last digit from the orignal number 20 | originalNum /= 10; 21 | } 22 | 23 | if (result == num) 24 | cout << num << " is an Armstrong number."; 25 | else 26 | cout << num << " is not an Armstrong number."; 27 | 28 | return 0; 29 | } -------------------------------------------------------------------------------- /Binary Number to Octal vice-versa.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | int convert(long long bin); 4 | int main() { 5 | long long bin; 6 | printf("Enter a binary number: "); 7 | scanf("%lld", &bin); 8 | printf("%lld in binary = %d in octal", bin, convert(bin)); 9 | return 0; 10 | } 11 | 12 | int convert(long long bin) { 13 | int oct = 0, dec = 0, i = 0; 14 | 15 | // converting binary to decimal 16 | while (bin != 0) { 17 | dec += (bin % 10) * pow(2, i); 18 | ++i; 19 | bin /= 10; 20 | } 21 | i = 1; 22 | 23 | // converting to decimal to octal 24 | while (dec != 0) { 25 | oct += (dec % 8) * i; 26 | dec /= 8; 27 | i *= 10; 28 | } 29 | return oct; 30 | } 31 | -------------------------------------------------------------------------------- /Binomial Coefficient: -------------------------------------------------------------------------------- 1 | // A naive recursive C++ implementation 2 | #include 3 | using namespace std; 4 | 5 | // Returns value of Binomial Coefficient C(n, k) 6 | int binomialCoeff(int n, int k) 7 | { 8 | // Base Cases 9 | if (k > n) 10 | return 0; 11 | if (k == 0 || k == n) 12 | return 1; 13 | 14 | // Recur 15 | return binomialCoeff(n - 1, k - 1) 16 | + binomialCoeff(n - 1, k); 17 | } 18 | 19 | /* Driver code*/ 20 | int main() 21 | { 22 | int n = 5, k = 2; 23 | cout << "Value of C(" << n << ", " << k << ") is " 24 | << binomialCoeff(n, k); 25 | return 0; 26 | } 27 | 28 | // This is code is contributed by rathbhupendra 29 | -------------------------------------------------------------------------------- /Black cells in a chessboard.cpp: -------------------------------------------------------------------------------- 1 | //Problem link: https://www.codechef.com/problems/BLACKCEL 2 | 3 | #include 4 | using namespace std; 5 | int main() 6 | { 7 | int n; 8 | cin>>n; 9 | int sq=n*n; 10 | int ans=sq/2; 11 | cout< 2 | using namespace std; 3 | 4 | #define int long long int 5 | #define pb emplace_back 6 | #define pp pop_back 7 | #define powof2(x) (x && !(x & (x-1))) 8 | 9 | #define INF 1000000000+10 10 | #define mod 1000000007 11 | 12 | const int N = 100005; 13 | int dp[N]; 14 | 15 | int BottomUp(int P[], int n) { 16 | dp[0] = 0; 17 | for(int i = 1; i <= n; i++) { 18 | int q = 0; 19 | for(int j = 1; j <= i; j++) { 20 | q = max(q, P[j] + dp[i-j]); 21 | } 22 | dp[i] = q; 23 | } 24 | return dp[n]; 25 | } 26 | void solve() { 27 | int n, k; cin >> n >> k; 28 | int P[k]; 29 | for(int i = 1; i <= k; i++) { 30 | cin >> P[i]; 31 | } 32 | int res = BottomUp(P, n); 33 | cout << res << "\n"; 34 | } 35 | 36 | signed main() { 37 | ios_base::sync_with_stdio(false); 38 | cin.tie(NULL); 39 | 40 | int t; 41 | t = 1; 42 | // cin >> t; 43 | while(t--) { 44 | solve(); 45 | } 46 | 47 | return 0; 48 | } -------------------------------------------------------------------------------- /Bubble sort CPP.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main () 4 | { 5 | int i, j,temp,pass=0; 6 | int n; cin>>n; 7 | int a[n]; 8 | for(i = 0; i>a[i]; 10 | } 11 | cout <<"Input list ...\n"; 12 | for(i = 0; i arr[j+1]){ 15 | 16 | // If the condition is true then swap them 17 | var temp = arr[j] 18 | arr[j] = arr[j + 1] 19 | arr[j+1] = temp 20 | } 21 | } 22 | } 23 | // Print the sorted array 24 | console.log(arr); 25 | } 26 | 27 | // This is our unsorted array 28 | var arr = [234, 43, 55, 63, 5, 6, 235, 547]; 29 | 30 | 31 | // Now pass this array to the bblSort() function 32 | bblSort(arr); -------------------------------------------------------------------------------- /Bubble_Sort.C: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | void main() 4 | { 5 | int n,i,j,a[100],t; 6 | printf("Enter the no of elements you need to sort"); 7 | scanf("%d",&n); 8 | printf("Enter the elements:"); 9 | for(i=0;i0;i--) 12 | { 13 | for(j=1;j 2 | int main() 3 | { 4 | printf("Hello World!"); 5 | 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /C++/0_1_knapsack.cpp: -------------------------------------------------------------------------------- 1 | vector>dp(1003); 2 | int knapsack(vector &A, vector &B, int w, int n,vector>&dp){ 3 | if(n==0||w==0){ 4 | return 0; 5 | } 6 | if(dp[n][w]!=-1){ 7 | return dp[n][w]; 8 | } 9 | if(B[n-1]<=w){ 10 | dp[n][w]=max(A[n-1]+knapsack(A,B,w-B[n-1],n-1,dp),knapsack(A,B,w,n-1),dp); 11 | } 12 | else{ 13 | dp[n][w]=knapsack(A,B,w,n-1,dp); 14 | } 15 | return dp[n][w]; 16 | } 17 | int Solution::solve(vector &A, vector &B, int C) { 18 | int i,j; 19 | for(i=0;i<1003;i++){ 20 | for(j=0;j<1003;j++){ 21 | dp[i].push_back(-1); 22 | } 23 | } 24 | return knapsack(A,B,C,A.size(), dp); 25 | } 26 | -------------------------------------------------------------------------------- /C++/BubbleSort.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | void bubbleSort(vector v) 6 | { 7 | int i = 0, t = 0; 8 | 9 | for (int i = 0; i < v.size() - 1; i++) 10 | { 11 | for (int j = 0; j < v.size() - i - 1; j++) 12 | { 13 | if (v[j] > v[j + 1]) 14 | { 15 | swap(v[j], v[j + 1]); 16 | t++; 17 | } 18 | } 19 | if (t == 0) 20 | { 21 | cout << "Already sorted" << endl; 22 | } 23 | } 24 | 25 | for (int i = 0; i < v.size(); i++) 26 | { 27 | cout << v[i] << " "; 28 | } 29 | } 30 | 31 | int main() 32 | { 33 | int size; 34 | cin >> size; 35 | 36 | vector v1(size); 37 | 38 | for (auto &i : v1) 39 | { 40 | cin >> i; 41 | } 42 | 43 | bubbleSort(v1); 44 | 45 | return 0; 46 | } -------------------------------------------------------------------------------- /C++/Butterfly pattern: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | int n; 8 | cout<<"Enter a number:"<>n; 10 | 11 | for(int i=1;i<=n;i++){ 12 | for(int j=1;j<=i;j++){ 13 | cout<<"*"; 14 | } 15 | int space=2*n-2*i; 16 | for(int j=1;j<=space;j++){ 17 | cout<<" "; 18 | } 19 | for(int j=1;j<=i;j++){ 20 | cout<<"*"; 21 | } 22 | cout<=1;i--){ 25 | for(int j=1;j<=i;j++){ 26 | cout<<"*"; 27 | } 28 | int space=2*n-2*i; 29 | for(int j=1;j<=space;j++){ 30 | cout<<" "; 31 | } 32 | for(int j=1;j<=i;j++){ 33 | cout<<"*"; 34 | } 35 | cout< 2 | using namespace std; 3 | 4 | template 5 | class Node{ 6 | public: 7 | T data; 8 | Node *next; 9 | 10 | Node(T data){ 11 | this->data = data; 12 | next = NULL; 13 | } 14 | }; 15 | 16 | template 17 | class Stack{ 18 | Node *head; 19 | int size; 20 | 21 | public: 22 | 23 | Stack(){ 24 | head = NULL; 25 | size = 0; 26 | } 27 | 28 | int getSize(){ 29 | return size; 30 | } 31 | 32 | bool isEmpty(){ 33 | return size == 0; 34 | } 35 | 36 | void push(T element){ 37 | Node *newNode = new Node(element); 38 | newNode->next = head; 39 | head = newNode; 40 | size++; 41 | } 42 | 43 | T pop(){ 44 | if(isEmpty()){ 45 | return 0; 46 | } -------------------------------------------------------------------------------- /C++/DDA.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | void main() 8 | { clrscr(); 9 | int gd=DETECT, gm; 10 | int x1,x2,y1,y2,dx,dy,steps,xinc,yinc; 11 | initgraph(&gd,&gm,"C:\\TurboC3\\BGI"); 12 | cout<<"Enter the starting coordinates:"<>x1>>y1; 14 | cout<<"Enter the end coordinates:"<>x2>>y2; 16 | dx=x2-x1; 17 | dy=y2-y1; 18 | if(abs(dx)>abs(dy)) 19 | steps=abs(dx); 20 | else 21 | steps=abs(dy); 22 | 23 | xinc=dx/steps; 24 | yinc=dy/steps; 25 | 26 | for(int i=0;i 2 | #include 3 | class NUM 4 | { 5 | private: 6 | int n; 7 | 8 | public: 9 | void getNum(int x) 10 | { 11 | n=x; 12 | } 13 | void dispNum(void) 14 | { 15 | cout << "value of n is: " << n; 16 | } 17 | void operator ++ (void) 18 | { 19 | n=++n; 20 | } 21 | void operator -- (void) 22 | { 23 | n=--n; 24 | } 25 | }; 26 | void main() 27 | { 28 | NUM num; 29 | Clrscr; 30 | num.getNum(10); 31 | ++num; 32 | cout << "After increment - "; 33 | num.dispNum(); 34 | cout << endl; 35 | --num; 36 | cout << "After decrement - "; 37 | num.dispNum(); 38 | cout << endl; 39 | getch(); 40 | } 41 | -------------------------------------------------------------------------------- /C++/LCM.cpp: -------------------------------------------------------------------------------- 1 | * 2 | Author Lakshay Goel 3 | Github profile: https://github.com/mrlakshaygoel 4 | Problem link: https://www.geeksforgeeks.org/program-to-find-lcm-of-two-numbers/ 5 | Given are two numbers we need to find their LCM 6 | */ 7 | #include 8 | using namespace std; 9 | unsigned long long int gcd(unsigned long long int num1,unsigned long long int num2){ 10 | if(num2 == 0){ 11 | return num1; 12 | } 13 | else{ 14 | gcd(num2,num1%num2); 15 | } 16 | } 17 | unsigned long long int lcm(int a,int b){ 18 | unsigned long long int x=gcd(a,b); 19 | unsigned long long int result=((a/x)*(b)); 20 | return result; 21 | } 22 | int main() 23 | { 24 | unsigned long long int n1,n2;cin>>n1>>n2; 25 | cout< 3 | using namespace std; 4 | 5 | int longest_increasing_subsequence(int arr[], int n) 6 | { 7 | vectorv(n); 8 | 9 | int ans; 10 | v[0] = 1; 11 | for (int i = 1; i < n; i++) { 12 | v[i] = 1; 13 | for (int j = 0; j < i; j++) 14 | if (arr[i] > arr[j] && v[i] < v[j] + 1) 15 | v[i] = v[j] + 1; 16 | } 17 | 18 | 19 | ans = *max_element(v.begin(),v.end()); 20 | return ans; 21 | } 22 | 23 | 24 | int main() 25 | { 26 | int n; 27 | cout << "Enter no of array elements: "; 28 | cin >> n; 29 | int arr[n]; 30 | cout << "Enter the array elements: "; 31 | for(int i=0;i>arr[i]; 33 | } 34 | cout << "Enter the size of longest increasing subsequence : " << longest_increasing_subsequence(arr,n); 35 | 36 | 37 | 38 | return 0; 39 | } 40 | -------------------------------------------------------------------------------- /C++/Merge Sorted Array.cpp: -------------------------------------------------------------------------------- 1 | class Solution { 2 | public: 3 | void merge(vector& nums1, int m, vector& nums2, int n) { 4 | int i =m-1, j= n-1, index = m+n -1; 5 | while(i>=0 && j>=0 ) 6 | { 7 | if(nums1[i] >= nums2[j]){ 8 | nums1[index--] = nums1[i--]; 9 | } 10 | else{ 11 | nums1[index--]= nums2[j--]; 12 | } 13 | } 14 | 15 | while(j>=0){ 16 | nums1[index--] = nums2[j--]; 17 | } 18 | 19 | } 20 | }; -------------------------------------------------------------------------------- /C++/PalindromeNumbers.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | int n,r,sum=0,temp; 6 | cout<<"Enter the Number="; 7 | cin>>n; 8 | temp=n; 9 | while(n>0) 10 | { 11 | r=n%10; 12 | sum=(sum*10)+r; 13 | n=n/10; 14 | } 15 | if(temp==sum) 16 | cout<<"Number is Palindrome."; 17 | else 18 | cout<<"Number is not Palindrome."; 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /C++/Pascal_Triangle.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | int r, c = 1; 7 | 8 | cout << "Number of rows: "; 9 | cin >> r; 10 | 11 | for(int i = 0; i < r; i++) 12 | { 13 | for(int space = 1; space <= r-i; space++) 14 | cout <<" "; 15 | 16 | for(int j = 0; j <= i; j++) 17 | { 18 | if (j == 0 || i == 0) 19 | c = 1; 20 | else 21 | c = c*(i-j+1)/j; 22 | 23 | cout << c << " "; 24 | } 25 | cout << endl; 26 | } 27 | 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /C++/PrintPyramid.cpp: -------------------------------------------------------------------------------- 1 | // C++ code to demonstrate star pattern 2 | #include 3 | using namespace std; 4 | 5 | // Function to demonstrate printing pattern 6 | void pypart2(int n) 7 | { 8 | int i = 0, j = 0, k = 0; 9 | while (i < n) { 10 | 11 | // for spacing 12 | while (k <= n - i - 2) { 13 | cout << " "; 14 | k++; 15 | } 16 | k = 0; 17 | 18 | // For Pattern printing 19 | while (j < 2 * i - 1) { 20 | cout << "*"; 21 | j++; 22 | } 23 | j = 0; 24 | i++; 25 | cout << endl; 26 | } 27 | } 28 | 29 | // Driver Code 30 | int main() 31 | { 32 | int n = 5; 33 | 34 | // Function Call 35 | pypart2(n); 36 | return 0; 37 | } -------------------------------------------------------------------------------- /C++/Prod_arr_exce_self.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | void prodArray(int a[], int n){ 4 | int p[n], prod=1; 5 | 6 | //Find product of all elements of a[] 7 | for(int i=0; i 4 | #include 5 | using namespace std; 6 | int main(){ 7 | cout<<" please enter a, b and c according to your quadratic equation ax^2 + bx + c = 0 "<> a; 11 | cout<<"enter b :"; 12 | cin>>b; 13 | cout<<"enter c :"; 14 | cin>>c; 15 | r1= (-b+ sqrt(b*b-4*a*c))/(2*a); 16 | r2= (-b-sqrt(b*b-4*a*c))/(2*a); 17 | cout<<"roots are"<< r1 <<" "< 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | 7 | int n; 8 | cout << ("Enter Size of Array "); 9 | cin >> n; 10 | 11 | cout << ("Enter Elements "); 12 | int arr[n]; 13 | for (int i = 0; i < n; i++) 14 | { 15 | cin >> arr[i]; 16 | } 17 | 18 | cout << ("The Array After Reversing is "); 19 | 20 | for (int j = n-1 ; j >= 0; j--) 21 | { 22 | cout << arr[j]<<" "; 23 | } 24 | 25 | return 0; 26 | } 27 | -------------------------------------------------------------------------------- /C++/Transpose of a Matrix.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() { 5 | int a[10][10], transpose[10][10], row, column, i, j; 6 | 7 | cout << "Enter rows and columns of matrix: "; 8 | cin >> row >> column; 9 | 10 | cout << "\nEnter elements of matrix: " << endl; 11 | 12 | // Storing matrix elements 13 | for (int i = 0; i < row; ++i) { 14 | for (int j = 0; j < column; ++j) { 15 | cout << "Enter element a" << i + 1 << j + 1 << ": "; 16 | cin >> a[i][j]; 17 | } 18 | } 19 | 20 | // Printing the a matrix 21 | cout << "\nEntered Matrix: " << endl; 22 | for (int i = 0; i < row; ++i) { 23 | for (int j = 0; j < column; ++j) { 24 | cout << " " << a[i][j]; 25 | if (j == column - 1) 26 | cout << endl << endl; 27 | } 28 | } -------------------------------------------------------------------------------- /C++/golomb_sequence.cpp: -------------------------------------------------------------------------------- 1 | // C++ Program to find first 2 | // n terms of Golomb sequence. 3 | #include 4 | using namespace std; 5 | 6 | // Print the first n term 7 | // of Golomb Sequence 8 | void printGolomb(int n) 9 | { 10 | int dp[n + 1]; 11 | 12 | // base cases 13 | dp[1] = 1; 14 | cout << dp[1] << " "; 15 | 16 | // Finding and printing first 17 | // n terms of Golomb Sequence. 18 | for (int i = 2; i <= n; i++) 19 | { 20 | dp[i] = 1 + dp[i - dp[dp[i - 1]]]; 21 | cout << dp[i] << " "; 22 | } 23 | } 24 | // Driver Code 25 | int main() 26 | { 27 | int n = 9; 28 | 29 | printGolomb(n); 30 | return 0; 31 | } 32 | -------------------------------------------------------------------------------- /C++/leap year or not.cpp: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include 4 | using namespace std; 5 | int main() 6 | { 7 | int yr; 8 | cout<<"Enter the Year: "; 9 | cin>>yr; 10 | if((yr%4==0) && (yr%100!=0)) 11 | cout<<"\nIt is a Leap Year"; 12 | else if(yr%400==0) 13 | cout<<"\nIt is a Leap Year"; 14 | else 15 | cout<<"\nIt is not a Leap Year"; 16 | cout< 2 | #include 3 | #include 4 | #include 5 | #define ll long long 6 | using namespace std; 7 | 8 | 9 | void nextLargerElement(vector arr, int n){ 10 | 11 | stacks; 12 | vectorvect1; 13 | vectorvect(n,-1); 14 | for(int i=0;i>t; 36 | while(t--) 37 | { 38 | 39 | int n; 40 | cin>>n; 41 | vector arr(n); 42 | for(int i=0;i>arr[i]; 44 | 45 | 46 | nextLargerElement(arr, n); 47 | 48 | } 49 | return 0; 50 | } -------------------------------------------------------------------------------- /C++/odd and even.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/C++/odd and even.exe -------------------------------------------------------------------------------- /C++/oppoverload.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | class test 5 | { 6 | int a; 7 | public: 8 | void get() 9 | { 10 | cin>>a; 11 | } 12 | 13 | void compare(test t2) 14 | { 15 | if (a==t2.a) 16 | cout<<"equal\n"; 17 | 18 | else 19 | cout<<"not equal\n"; 20 | } 21 | 22 | }; 23 | 24 | int main() 25 | { 26 | test t1,t2; 27 | cout<<"enter the a of t1\n"; 28 | t1.get(); 29 | cout<<"enter the a of t2\n"; 30 | t2.get(); 31 | 32 | t1.compare(t2); 33 | } 34 | 35 | -------------------------------------------------------------------------------- /C++/prime_number.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | bool isPrime(int n) 5 | { 6 | // Corner case 7 | if (n <= 1) 8 | return false; 9 | 10 | 11 | for (int i = 2; i < n; i++) 12 | if (n % i == 0) 13 | return false; 14 | 15 | return true; 16 | } 17 | 18 | 19 | int main() 20 | { 21 | isPrime(11) ? cout << " true\n" : cout << " false\n"; 22 | isPrime(15) ? cout << " true\n" : cout << " false\n"; 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /C++/shell_sort.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int shellSort(int arr[], int n) 5 | { 6 | for (int gap = n / 2; gap > 0; gap /= 2) 7 | { 8 | 9 | for (int i = gap; i < n; i += 1) 10 | { 11 | int temp = arr[i]; 12 | int j; 13 | for (j = i; j >= gap && arr[j - gap] > temp; j -= gap) 14 | arr[j] = arr[j - gap]; 15 | 16 | arr[j] = temp; 17 | } 18 | } 19 | return 0; 20 | } 21 | 22 | void printArray(int arr[], int n) 23 | { 24 | for (int i = 0; i < n; i++) 25 | cout << arr[i] << " "; 26 | } 27 | 28 | int main() 29 | { 30 | int arr[] = {12, 34, 54, 2, 3}, i; 31 | int n = sizeof(arr) / sizeof(arr[0]); 32 | 33 | cout << "Array before sorting: \n"; 34 | printArray(arr, n); 35 | 36 | shellSort(arr, n); 37 | 38 | cout << "\nArray after sorting: \n"; 39 | printArray(arr, n); 40 | 41 | return 0; 42 | } 43 | -------------------------------------------------------------------------------- /C++/subset_sum_problem.cpp: -------------------------------------------------------------------------------- 1 | int subset(vector &A, int B,int n,vector>&dp){ 2 | if (B==0){ 3 | return 1; 4 | } 5 | if (n==0){ 6 | return 0; 7 | } 8 | if (dp[n][B]!=-1){ 9 | return dp[n][B]; 10 | } 11 | if (A[n-1]<=B){ 12 | dp[n][B]=subset(A,B-A[n-1],n-1,dp)||subset(A,B,n-1,dp); 13 | } 14 | else { 15 | dp[n][B]=subset(A,B,n-1,dp); 16 | } 17 | return dp[n][B]; 18 | } 19 | int Solution::solve (vector &A, int B) { 20 | int n=A.size(),i,j; 21 | vector>dp(n+1); 22 | for (i=0;i 4 | 5 | //Time Complexity: O(4^n) 6 | int catalan(int n) 7 | { 8 | int result=0; 9 | 10 | if(n <= 1) 11 | return 1; 12 | 13 | for(int i=0 ; i 2 | 3 | 4 | 5 | 6 | Document 7 | 8 | 9 | 10 |
11 | 12 |

13 |
14 | 15 | 16 | -------------------------------------------------------------------------------- /Change BG Color HTML CSS JS/main.js: -------------------------------------------------------------------------------- 1 | const button = document.querySelector('button'); 2 | const h2El = document.querySelector('h2'); 3 | const bgEl = document.querySelector('section'); 4 | // const hexColorEl = [1,2,3,4,5,6,7,8,9,'A','B','c','D','E','F']; 5 | 6 | button.addEventListener('click', () => { 7 | let color = '#'; 8 | color += Math.random().toString(16).slice(2, 8).toUpperCase(); 9 | // for(i=0; i<6; i++){ 10 | // const number = Math.floor(Math.random()*hexColorEl.length); 11 | // color += hexColorEl[number]; 12 | // } 13 | // console.log(color) 14 | bgEl.style.backgroundColor = color; 15 | h2El.innerText = color 16 | }); 17 | -------------------------------------------------------------------------------- /Change BG Color HTML CSS JS/style.css: -------------------------------------------------------------------------------- 1 | *{ 2 | padding: 0; 3 | margin: 0; 4 | box-sizing: border-box; 5 | } 6 | section{ 7 | height:100vh; 8 | width: 100%; 9 | display: flex; 10 | align-items: center; 11 | justify-content: center; 12 | flex-direction: column; 13 | } 14 | button{ 15 | border: none; 16 | outline: none; 17 | background-color:aquamarine; 18 | font-size: 24px; 19 | font-family: 'Montserrat'; 20 | padding: 20px; 21 | cursor: pointer; 22 | } 23 | h2{ 24 | font-family: 'Montserrat'; 25 | font-size: 30px; 26 | margin-top: 30px; 27 | } -------------------------------------------------------------------------------- /CharCaseCheck.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | public class CharCaseCheck { 3 | 4 | public static void main(String[] args) { 5 | Scanner sc = new Scanner(System.in); 6 | char ch = sc.next().trim().charAt(0); 7 | System.out.println(ch); 8 | 9 | if(ch >= 'a' && ch <= 'z') { 10 | System.out.println("lowecase"); 11 | }else { 12 | System.out.println("uppercase"); 13 | } 14 | 15 | 16 | //USE OF charAt(0) 17 | // String word = "heelo"; 18 | // System.out.println(word.charAt(2)); 19 | //OUTPUT: e 20 | 21 | 22 | //USE OF TRIM FUNCTION 23 | // System.out.println(sc.next().trim()); 24 | //INPUT: hello guuyss hcbDHCbzdx || 25 | //OUTPUT:hello 26 | 27 | 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /Check Whether a Character is a Vowel or Consonant.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main() { 3 | char c; 4 | int lowercase_vowel, uppercase_vowel; 5 | printf("Enter an alphabet: "); 6 | scanf("%c", &c); 7 | 8 | // evaluates to 1 if variable c is a lowercase vowel 9 | lowercase_vowel = (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u'); 10 | 11 | // evaluates to 1 if variable c is a uppercase vowel 12 | uppercase_vowel = (c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U'); 13 | 14 | // evaluates to 1 (true) if c is a vowel 15 | if (lowercase_vowel || uppercase_vowel) 16 | printf("%c is a vowel.", c); 17 | else 18 | printf("%c is a consonant.", c); 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /Check Whether a Number is Positive or Negative.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main() { 3 | double num; 4 | printf("Enter a number: "); 5 | scanf("%lf", &num); 6 | if (num <= 0.0) { 7 | if (num == 0.0) 8 | printf("You entered 0."); 9 | else 10 | printf("You entered a negative number."); 11 | } else 12 | printf("You entered a positive number."); 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /CheckArmstrongNO.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | intnum, temp, noOfDigit=0, res=0, rem, pow, i; 6 | cout<<"Enter the Number: "; 7 | cin>>num; 8 | temp = num; 9 | while(num>0) 10 | { 11 | num = num/10; 12 | noOfDigit++; 13 | } 14 | num = temp; 15 | while(num>0) 16 | { 17 | rem = num%10; 18 | pow = 1; 19 | i = 0; 20 | while(i 2 | int main() { 3 | int dividend, divisor, quotient, remainder; 4 | printf("Enter dividend: "); 5 | scanf("%d", ÷nd); 6 | printf("Enter divisor: "); 7 | scanf("%d", &divisor); 8 | 9 | // Computes quotient 10 | quotient = dividend / divisor; 11 | 12 | // Computes remainder 13 | remainder = dividend % divisor; 14 | 15 | printf("Quotient = %d\n", quotient); 16 | printf("Remainder = %d", remainder); 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /Count number of ways to cover a distance: -------------------------------------------------------------------------------- 1 | // A naive recursive C++ program to count number of ways to cover 2 | // a distance with 1, 2 and 3 steps 3 | #include 4 | using namespace std; 5 | 6 | // Returns count of ways to cover 'dist' 7 | int printCountRec(int dist) 8 | { 9 | // Base cases 10 | if (dist<0) return 0; 11 | if (dist==0) return 1; 12 | 13 | // Recur for all previous 3 and add the results 14 | return printCountRec(dist-1) + 15 | printCountRec(dist-2) + 16 | printCountRec(dist-3); 17 | } 18 | 19 | // driver program 20 | int main() 21 | { 22 | int dist = 4; 23 | cout << printCountRec(dist); 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /Count ways to build street under given constraints: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | // a street of n rows 4 | long countWays(int n) 5 | { 6 | long dp[2][n + 1]; 7 | 8 | // base case 9 | dp[0][1] = 1; 10 | dp[1][1] = 2; 11 | 12 | for (int i = 2; i <= n; i++) 13 | { 14 | 15 | // ways of building houses in both 16 | // the spots of ith row 17 | dp[0][i] = dp[0][i - 1] + dp[1][i - 1]; 18 | 19 | // ways of building an office in one of 20 | // the two spots of ith row 21 | dp[1][i] = dp[0][i - 1] * 2 + dp[1][i - 1]; 22 | } 23 | 24 | // total ways for n rows 25 | return dp[0][n] + dp[1][n]; 26 | } 27 | 28 | // driver program for checking above function 29 | int main() 30 | { 31 | 32 | int n = 5; 33 | cout << "Total no of ways with n = " << n 34 | << " are: " << countWays(n) << endl; 35 | } 36 | -------------------------------------------------------------------------------- /DFS without using visited array.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | vectorgraph[100]; 5 | 6 | void DFS(int u) 7 | { 8 | cout<>number_of_nodes>>number_of_nodes; 19 | 20 | int u,v; 21 | for(int i=0;i>u>>v; 24 | graph[u].push_back(v); 25 | graph[v].push_back(u); 26 | } 27 | 28 | // Here we have pass the 0 as we can assume for time-being that 0 is the root.. 29 | DFS(0); 30 | 31 | } -------------------------------------------------------------------------------- /Decimal to Binary.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | class ConvertToBinary 3 | { 4 | public static void main(String[] args) 5 | { 6 | Scanner dtpe = new Scanner(System.in); 7 | System.out.println("Enter a no."); 8 | int a = dtpe.nextInt(); 9 | int binary[] = new int[1000]; int c=0; 10 | while(a>0) 11 | { 12 | int d= a%2; 13 | binary[c] = d; 14 | a=(int)a/2; c++; 15 | } 16 | 17 | for(int x=c-1; x>=0; x--) 18 | System.out.print(binary[x] + " "); 19 | }} 20 | -------------------------------------------------------------------------------- /DiamondShape.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | public class DiamondShape { 3 | 4 | public static void main(String[] args) { 5 | int i, j, k, temp = 1; 6 | for (i = 0; i < 5; i++) { 7 | for (k = i; k < 4; k++) 8 | System.out.print(" "); 9 | System.out.print("*"); 10 | if (i != 0) { 11 | for (j = 1; j <= temp; j++) 12 | System.out.print(" "); 13 | System.out.print("*"); 14 | temp += 2; 15 | } 16 | System.out.println(); 17 | } 18 | temp-=4; 19 | for(i=0;i<4;i++){ 20 | for(k=0;k<=i;k++) 21 | System.out.print(" "); 22 | System.out.print("*"); 23 | if(i!=3){ 24 | for(j=1;j<=temp;j++) 25 | System.out.print(" "); 26 | System.out.print("*"); 27 | temp-=2; 28 | } 29 | System.out.println(); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Display Fibonacci Series.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() { 5 | int n, t1 = 0, t2 = 1, nextTerm = 0; 6 | 7 | cout << "Enter the number of terms: "; 8 | cin >> n; 9 | 10 | cout << "Fibonacci Series: "; 11 | 12 | for (int i = 1; i <= n; ++i) { 13 | // Prints the first two terms. 14 | if(i == 1) { 15 | cout << t1 << ", "; 16 | continue; 17 | } 18 | if(i == 2) { 19 | cout << t2 << ", "; 20 | continue; 21 | } 22 | nextTerm = t1 + t2; 23 | t1 = t2; 24 | t2 = nextTerm; 25 | 26 | cout << nextTerm << ", "; 27 | } 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /Doubly Linked List/DLinkedList.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Doubly Linked List/DLinkedList.class -------------------------------------------------------------------------------- /Doubly Linked List/Node.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Doubly Linked List/Node.class -------------------------------------------------------------------------------- /Doubly Linked List/Two pointers/DLinkedList.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Doubly Linked List/Two pointers/DLinkedList.class -------------------------------------------------------------------------------- /Doubly Linked List/Two pointers/Node.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Doubly Linked List/Two pointers/Node.class -------------------------------------------------------------------------------- /Doubly Linked List/Two pointers/testDLinkedList.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Doubly Linked List/Two pointers/testDLinkedList.class -------------------------------------------------------------------------------- /Doubly Linked List/Two pointers/testDLinkedList.java: -------------------------------------------------------------------------------- 1 | class testDLinkedList{ 2 | public static void main(String args[]){ 3 | DLinkedList list = new DLinkedList(); 4 | 5 | list.insertFirst(75); 6 | list.insertFirst(64); 7 | list.insertFirst(24); 8 | list.insertFirst(34); 9 | list.insertFirst(89); 10 | list.printDLL(); 11 | 12 | list.insertLast(200); 13 | list.printDLL(); 14 | 15 | list.insertAt(300, 3); 16 | list.printDLL(); 17 | 18 | Node n1 = list.deleteFirst(); 19 | System.out.println("Delete first: " + n1.data); 20 | list.printDLL(); 21 | 22 | Node n2 = list.deleteLast(); 23 | System.out.println("Delete last: " + n2.data); 24 | list.printDLL(); 25 | 26 | list.deleteAt(3); 27 | list.printDLL(); 28 | 29 | list.reverseDLL(); 30 | list.printDLL(); 31 | } 32 | } -------------------------------------------------------------------------------- /Doubly Linked List/testDLinkedList.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Doubly Linked List/testDLinkedList.class -------------------------------------------------------------------------------- /Encryption and Decryption/decrypt.c: -------------------------------------------------------------------------------- 1 | // to decrpyt what we just encrypted , we subtract 1 from the ascii value of the encrypted message. 2 | #include 3 | #include 4 | void decrypt (char *str){ 5 | char *ptr=str; 6 | while(*ptr!='\0'){ 7 | *ptr=*ptr-1; 8 | ptr++; 9 | } 10 | } 11 | int main(){ 12 | char str[]="nxpovtff"; 13 | decrypt(str); 14 | printf("Decrypted string:%s",str); 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /Encryption and Decryption/encrypt.c: -------------------------------------------------------------------------------- 1 | //encrypt a string by adding 1 to the ascii value of its characters 2 | #include 3 | #include 4 | void encrypt (char *str){ 5 | char *ptr=str; 6 | while(*ptr!='\0'){ 7 | *ptr=*ptr+1; 8 | ptr++; 9 | } 10 | } 11 | int main(){ 12 | char str[]="mwonusee"; 13 | encrypt(str); 14 | printf("Encrypted string:%s",str); 15 | return 0; 16 | } -------------------------------------------------------------------------------- /Factorial.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | using namespace std; 4 | int main() { 5 | int n = 5, fact = 1, i; 6 | for(i=1; i<=n; i++) 7 | fact = fact * i; 8 | cout<<"Factorial of "< 2 | 3 | void fab(int n) 4 | { 5 | static int n1=0,n2=1,n3; 6 | if(n>0) 7 | { 8 | n3 = n1 + n2; 9 | n1 = n2; 10 | n2 = n3; 11 | printf("%d ",n3); 12 | fab(n-1); 13 | } 14 | } 15 | 16 | int main() 17 | { 18 | int n; 19 | printf("Enter the number of elements: "); 20 | scanf("%d",&n); 21 | printf("Fibonacci Series: "); 22 | printf("%d %d ",0,1); 23 | fab(n-2); 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /Fibonacci series using recursion.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | // fibonacci series using recursion 5 | int fibonacci(int n){ 6 | if (n<=1) 7 | return n; 8 | else 9 | return(fibonacci(n-1) + fibonacci(n-2)); 10 | } 11 | 12 | int main() { 13 | int n; 14 | cout << "Enter the number of terms: "; 15 | cin >> n; 16 | 17 | int fib = fibonacci(n); 18 | cout << "Fibonacci Series output: "< 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | int divisor, dividend, quotient, remainder; 7 | 8 | cout << "Enter dividend: "; 9 | cin >> dividend; 10 | 11 | cout << "Enter divisor: "; 12 | cin >> divisor; 13 | 14 | quotient = dividend / divisor; 15 | remainder = dividend % divisor; 16 | 17 | cout << "Quotient = " << quotient << endl; 18 | cout << "Remainder = " << remainder; 19 | 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /Find n-th element from Stern’s Diatomic Series: -------------------------------------------------------------------------------- 1 | // Program to find the nth element 2 | // of Stern's Diatomic Series 3 | #include 4 | using namespace std; 5 | 6 | // function to find nth stern' 7 | // diatomic series 8 | int findSDSFunc(int n) 9 | { 10 | // Initializing the DP array 11 | int DP[n+1]; 12 | 13 | // SET the Base case 14 | DP[0] = 0; 15 | DP[1] = 1; 16 | 17 | // Traversing the array from 18 | // 2nd Element to nth Element 19 | for (int i = 2; i <= n; i++) { 20 | 21 | // Case 1: for even n 22 | if (i % 2 == 0) 23 | DP[i] = DP[i / 2]; 24 | 25 | // Case 2: for odd n 26 | else 27 | DP[i] = DP[(i - 1) / 2] + 28 | DP[(i + 1) / 2]; 29 | } 30 | return DP[n]; 31 | } 32 | 33 | // Driver program 34 | int main() 35 | { 36 | int n = 15; 37 | cout << findSDSFunc(n) << endl; 38 | return 0; 39 | } 40 | -------------------------------------------------------------------------------- /Floor of an element in sorted array.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int solve(int arr[],int n,int target){ 4 | int ans=0; 5 | int low=0; 6 | int high=n-1; 7 | while(low<=high){ 8 | int mid=low+(high-low)/2; 9 | if(arr[mid]==target){ 10 | return arr[mid]; 11 | } 12 | else if(arr[mid]>target){ 13 | high=mid-1; 14 | } 15 | else{ 16 | ans=arr[mid]; 17 | low=mid+1; 18 | } 19 | } 20 | return ans; 21 | } 22 | int main(){ 23 | int n; 24 | cin>>n; 25 | int arr[n]; 26 | for(int i=0;i>arr[i]; 28 | } 29 | int target; 30 | cin>>target; 31 | int ans=solve(arr,n,target); 32 | cout<<"floor of "< 2 | 3 | void main () 4 | { 5 | int arr[100],i,n,largest,sec_largest; 6 | printf("Enter the size of the array?"); 7 | scanf("%d",&n); 8 | printf("Enter the elements of the array?"); 9 | for(i = 0; ilargest) 18 | { 19 | largest = arr[i]; 20 | } 21 | else if (arr[i]!=largest) 22 | { 23 | 24 | } 25 | } 26 | printf("largest = %d",largest); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /Gouravmoonka.md: -------------------------------------------------------------------------------- 1 | #include 2 | int main() { 3 | int n, i, sum = 0; 4 | printf("Enter a positive integer: "); 5 | scanf("%d", &n); 6 | i = 1; 7 | 8 | while (i <= n) { 9 | sum += i; 10 | ++i; 11 | } 12 | 13 | printf("Sum = %d", sum); 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /Hailstone Sequence.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class Hailstone 3 | { 4 | void main() 5 | { 6 | Scanner sc=new Scanner(System.in); 7 | System.out.println("Enter a number"); 8 | int N=sc.nextInt(); 9 | System.out.println("Hailstone Sequence:"); 10 | seq(N); 11 | } 12 | 13 | void seq(int N) 14 | { 15 | if(N<=0) 16 | { 17 | System.out.println("Invalid Input"); 18 | } 19 | else if(N==1) 20 | { 21 | N=0; 22 | } 23 | else if(N%2==0) 24 | { 25 | System.out.println(N/2); 26 | N=N/2; 27 | seq(N); 28 | } 29 | else 30 | { 31 | System.out.println(3*N+1); 32 | N=3*N+1; 33 | seq(N); 34 | } 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /HelloWorld.c: -------------------------------------------------------------------------------- 1 | /* c program for printing hello world */ 2 | #include 3 | int main() 4 | { 5 | printf("Hello World!\n" ); //Printf used to print values on the console 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /HelloWorld.java: -------------------------------------------------------------------------------- 1 | public class HelloWorld { 2 | public static void main(String[] args) { 3 | System.out.println("Hello World!!!"); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /InsertionSortInPython.py: -------------------------------------------------------------------------------- 1 | /* 2 | * insertion sort algorithm idea is to build the sorted array in place, shifting elements out of the way if necessary to make room as you go. 3 | * insertion sort is of complexity O(n^2) and omega(n) 4 | 5 | // -- PSEUDO CODE -- 6 | // Call the first element of the array "sorted". 7 | // Repeat until all elements are sorted: 8 | // Look at the next unsorted element. Insert into the "sorted" portion by shifting the requisite number of elements. 9 | */ 10 | 11 | def insert(array, rightIndex, value): 12 | j = rightIndex 13 | while j >= 0 and array[j] > value: 14 | array[j + 1] = array[j] 15 | j = j - 1 16 | array[j + 1] = value 17 | 18 | 19 | def insertionSort(array): 20 | for current in range(0, len(array) - 1): 21 | insert(array, current, array[current + 1]) 22 | 23 | return 24 | -------------------------------------------------------------------------------- /Insertion_Sort.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | void insertion_sort(int a[],int n) 4 | { 5 | int i,cur,j; 6 | for(i=1; i=0 && a[j]>cur) 11 | { 12 | a[j+1]=a[j]; 13 | j--; 14 | } 15 | a[j+1]=cur; 16 | } 17 | cout<<"Sorted Element\n"; 18 | for(i=0;i0){ 7 | rem = n%10; 8 | ans = ans*10+rem; 9 | n=n/10; 10 | } 11 | if(ans==temp){ 12 | return true; 13 | } 14 | return false; 15 | } 16 | public static void main(String[] args){ 17 | int N = 124321; 18 | boolean res = isPalindrome(N); 19 | System.out.print(res); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Java/Stacks/StackX.java: -------------------------------------------------------------------------------- 1 | package stacks; 2 | 3 | public class StackX { 4 | private int maxSize; 5 | private char[] stackArray; 6 | private int top; 7 | 8 | public StackX (int s) { 9 | maxSize = s; 10 | stackArray = new char[maxSize]; 11 | top = -1; 12 | } 13 | public void push (char j) { 14 | if (top == (maxSize-1)) 15 | System.out.println("Stack is Full"); 16 | else 17 | { 18 | stackArray[++top]=j; 19 | } 20 | } 21 | public char pop() 22 | { 23 | return stackArray[top--]; 24 | } 25 | public char peek() 26 | { 27 | return stackArray[top]; 28 | } 29 | public boolean isEmpty() 30 | { 31 | if(top == -1) 32 | return true; 33 | else 34 | return false; 35 | } 36 | public boolean isFull() 37 | { 38 | if(top == maxSize-1) 39 | return true; 40 | else 41 | return false; 42 | } 43 | } 44 | 45 | -------------------------------------------------------------------------------- /KadaneAlgo.java: -------------------------------------------------------------------------------- 1 | class KadaneAlgo{ 2 | // arr: input array 3 | // n: size of array 4 | //Function to find the sum of contiguous subarray with maximum sum. 5 | long maxSubarraySum(int arr[], int n){ 6 | long currSum=0; //track current sum 7 | long sumSoFar=Long.MIN_VALUE; 8 | 9 | for(int i=0;i 2 | #include 3 | using namespace std; 4 | 5 | int kgrammar(int n, int k) 6 | { 7 | int i; 8 | if (k > pow(2, n - 1) || k<1) 9 | return -1; 10 | else 11 | { 12 | if (n == 1) 13 | return 1; 14 | 15 | int l = (k / 2) + (k % 2); 16 | i = kgrammar(n - 1, l); 17 | bool num; 18 | if (k % 2 == 0) 19 | num = 0; 20 | else 21 | num = 0; 22 | if (i == 0) 23 | return num; 24 | else 25 | return !num; 26 | } 27 | } 28 | int main() 29 | { 30 | int n,k; 31 | cin>>n>>k; 32 | cout << kgrammar(n,k); 33 | return 0; 34 | } -------------------------------------------------------------------------------- /Lapindromes.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | int n; 6 | cin>>n; 7 | while(n--) 8 | { 9 | string str1; 10 | cin>>str1; 11 | string s1,s2; 12 | int len=str1.size(); 13 | s1=str1.substr(0,len/2); 14 | if((len%2)!=0) 15 | { 16 | s2=str1.substr(len/2+1,len-1); 17 | } 18 | else 19 | { 20 | s2=str1.substr(len/2,len-1); 21 | } 22 | sort(s1.begin(),s1.end()); 23 | sort(s2.begin(),s2.end()); 24 | if(s1==s2) 25 | { 26 | cout<<"YES"< 3 | #include 4 | using namespace std; 5 | 6 | int maxSubArraySum(int a[], int size) 7 | { 8 | int max_so_far = INT_MIN, max_ending_here = 0, 9 | start =0, end = 0, s=0; 10 | 11 | for (int i=0; i< size; i++ ) 12 | { 13 | max_ending_here += a[i]; 14 | 15 | if (max_so_far < max_ending_here) 16 | { 17 | max_so_far = max_ending_here; 18 | start = s; 19 | end = i; 20 | } 21 | 22 | if (max_ending_here < 0) 23 | { 24 | max_ending_here = 0; 25 | s = i + 1; 26 | } 27 | } 28 | cout << "Maximum contiguous sum is " 29 | << max_so_far << endl; 30 | cout << "Starting index "<< start 31 | << endl << "Ending index "<< end << endl; 32 | } 33 | 34 | /*Driver program to test maxSubArraySum*/ 35 | int main() 36 | { 37 | int a[] = {-2, -3, 4, -1, -2, 1, 5, -3}; 38 | int n = sizeof(a)/sizeof(a[0]); 39 | int max_sum = maxSubArraySum(a, n); 40 | return 0; 41 | } 42 | -------------------------------------------------------------------------------- /Leap year program in C: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | int year; 5 | 6 | printf("Enter a year to check if it's a leap year\n"); 7 | scanf("%d", &year); 8 | 9 | if (year%400 == 0) // Exactly divisible by 400, e.g., 1600, 2000 10 | printf("%d is a leap year.\n", year); 11 | else if (year%100 == 0) // Exactly divisible by 100 and not by 400, e.g., 1900, 2100 12 | printf("%d isn't a leap year.\n", year); 13 | else if (year%4 == 0) // Exactly divisible by 4 and neither by 100 nor 400, e.g., 2016, 2020 14 | printf("%d is a leap year.\n", year); 15 | else // Not divisible by 4 or 100 or 400, e.g., 2017, 2018, 2019 16 | printf("%d isn't a leap year.\n", year); 17 | 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /Link.dart: -------------------------------------------------------------------------------- 1 | Link( 2 | 3 | target: LinkTarget.blank, 4 | 5 | uri: Uri.parse(widget.postArtLink), 6 | 7 | builder: (context, followLink) { 8 | 9 | return ElevatedButton( 10 | 11 | onPressed: followLink, 12 | 13 | child: Text("View Art / Download")); 14 | 15 | }) 16 | -------------------------------------------------------------------------------- /LinkedList_singlenode.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | struct node { 4 | int data; 5 | struct node *link; 6 | }; 7 | int main() 8 | { 9 | struct node *head=NULL; 10 | head->data=45; 11 | head->link=NULL; 12 | 13 | cout<data<link< 2 | #include 3 | 4 | struct Node{ 5 | int data; 6 | struct Node* next; 7 | }; 8 | 9 | void displayList(struct Node* n){ 10 | while(n != NULL){ 11 | printf("%d ", n->data); 12 | 13 | n = n->next; 14 | } 15 | printf("\n"); 16 | } 17 | 18 | int main(){ 19 | struct Node* head = NULL; 20 | struct Node* second = NULL; 21 | struct Node* third = NULL; 22 | struct Node* fourth = NULL; 23 | 24 | head = (struct Node*)malloc(sizeof(struct Node)); 25 | second = (struct Node*)malloc(sizeof(struct Node)); 26 | third = (struct Node*)malloc(sizeof(struct Node)); 27 | fourth = (struct Node*)malloc(sizeof(struct Node)); 28 | 29 | head->data = 10; 30 | head->next = second; 31 | 32 | second->data = 20; 33 | second->next = third; 34 | 35 | third->data = 30; 36 | third->next = fourth; 37 | 38 | fourth->data = 40; 39 | fourth->next = NULL; 40 | 41 | displayList(head); 42 | 43 | return 0; 44 | } -------------------------------------------------------------------------------- /Mahasena_Codechef_solution.cpp: -------------------------------------------------------------------------------- 1 | //problem statement:- https://www.codechef.com/problems/AMR15A 2 | 3 | #include 4 | using namespace std; 5 | 6 | string getResult(int arr[],int num){ 7 | int oddCounter=0,evenCounter=0; 8 | for(int j=0;joddCounter?"READY FOR BATTEL":"NOT READY"; 17 | } 18 | 19 | int main(){ 20 | int num; 21 | cin>>num; 22 | int arr[num]; 23 | for(int i=0;i>arr[i]; 25 | } 26 | cout< 2 | using namespace std; 3 | void findMajority(int arr[], int n) 4 | { 5 | int maxCount = 0; 6 | int index = -1; // sentinels 7 | for (int i = 0; i < n; i++) { 8 | int count = 0; 9 | for (int j = 0; j < n; j++) { 10 | if (arr[i] == arr[j]) 11 | count++; 12 | } 13 | if (count > maxCount) { 14 | maxCount = count; 15 | index = i; 16 | } 17 | } 18 | if (maxCount > n / 2) 19 | cout << arr[index] << endl; 20 | 21 | else 22 | cout << "No Majority Element" << endl; 23 | } 24 | int main() 25 | { 26 | int arr[] = { 1, 1, 2, 1, 3, 5, 1 }; 27 | int n = sizeof(arr) / sizeof(arr[0]); 28 | 29 | // Function calling 30 | findMajority(arr, n); 31 | 32 | return 0; 33 | } 34 | -------------------------------------------------------------------------------- /MaxMin.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | int main() 5 | { 6 | cout << "\n<<<========MaxMin array========>>>\n"; 7 | 8 | int arr[5] = {10, 43, 12, 5, 300}, max, min; 9 | cout << "\nThe given array is : \n"; 10 | for (int i = 0; i < 5; i++) 11 | { 12 | cout << arr[i] << " "; 13 | } 14 | min = arr[0]; 15 | max = arr[0]; 16 | for (int i = 0; i < 4; i++) 17 | { 18 | if (arr[i + 1] < min) 19 | { 20 | // max = min; 21 | min = arr[i + 1]; 22 | } 23 | if (arr[i + 1] > max) 24 | { 25 | // min = max; 26 | max = arr[i + 1]; 27 | } 28 | } 29 | cout << "\nMaximum element is : " << max << "\nMinimum element is : " << min; 30 | } -------------------------------------------------------------------------------- /Maximum element in array.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main(){ 4 | int n; 5 | cin>>n; 6 | int arr[n]; 7 | for(int i=0;i>arr[i]; 9 | } 10 | int mx=INT_MIN; 11 | for(int i=0;i 2 | int main() 3 | { 4 | puts("Hello World!"); 5 | return 0; 6 | } -------------------------------------------------------------------------------- /MyFirstApplication/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | -------------------------------------------------------------------------------- /MyFirstApplication/.idea/.name: -------------------------------------------------------------------------------- 1 | My First Application -------------------------------------------------------------------------------- /MyFirstApplication/.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 20 | 21 | -------------------------------------------------------------------------------- /MyFirstApplication/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | -------------------------------------------------------------------------------- /MyFirstApplication/.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /MyFirstApplication/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /MyFirstApplication/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /MyFirstApplication/app/src/androidTest/java/com/example/myfirstapplication/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.example.myfirstapplication; 2 | 3 | import android.content.Context; 4 | 5 | import androidx.test.platform.app.InstrumentationRegistry; 6 | import androidx.test.ext.junit.runners.AndroidJUnit4; 7 | 8 | import org.junit.Test; 9 | import org.junit.runner.RunWith; 10 | 11 | import static org.junit.Assert.*; 12 | 13 | /** 14 | * Instrumented test, which will execute on an Android device. 15 | * 16 | * @see Testing documentation 17 | */ 18 | @RunWith(AndroidJUnit4.class) 19 | public class ExampleInstrumentedTest { 20 | @Test 21 | public void useAppContext() { 22 | // Context of the app under test. 23 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); 24 | assertEquals("com.example.myfirstapplication", appContext.getPackageName()); 25 | } 26 | } -------------------------------------------------------------------------------- /MyFirstApplication/app/src/main/java/com/example/myfirstapplication/InfoActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.myfirstapplication; 2 | 3 | import androidx.appcompat.app.AppCompatActivity; 4 | 5 | import android.annotation.SuppressLint; 6 | import android.content.Intent; 7 | import android.os.Bundle; 8 | import android.widget.EditText; 9 | import android.widget.TextView; 10 | 11 | public class InfoActivity extends AppCompatActivity { 12 | 13 | TextView email; 14 | 15 | @Override 16 | protected void onCreate(Bundle savedInstanceState) { 17 | super.onCreate(savedInstanceState); 18 | setContentView(R.layout.activity_info); 19 | email=(TextView)findViewById(R.id.textView2); 20 | //getting data from login activity 21 | Intent loginCall=getIntent(); 22 | String displayEmail=loginCall.getStringExtra("Email"); 23 | //displaying it on this activity 24 | email.setText(displayEmail); 25 | } 26 | } -------------------------------------------------------------------------------- /MyFirstApplication/app/src/main/java/com/example/myfirstapplication/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.myfirstapplication; 2 | 3 | import androidx.appcompat.app.AppCompatActivity; 4 | 5 | import android.content.Intent; 6 | import android.os.Bundle; 7 | 8 | import com.example.myfirstapplication.ui.login.LoginActivity; 9 | 10 | public class MainActivity extends AppCompatActivity { 11 | 12 | @Override 13 | protected void onCreate(Bundle savedInstanceState) { 14 | super.onCreate(savedInstanceState); 15 | setContentView(R.layout.activity_main); 16 | Intent callSignup=new Intent(getApplicationContext(), SignupActivity.class); 17 | startActivity(callSignup); 18 | System.out.println("I am here!"); 19 | } 20 | } -------------------------------------------------------------------------------- /MyFirstApplication/app/src/main/java/com/example/myfirstapplication/data/model/LoggedInUser.java: -------------------------------------------------------------------------------- 1 | package com.example.myfirstapplication.data.model; 2 | 3 | /** 4 | * Data class that captures user information for logged in users retrieved from LoginRepository 5 | */ 6 | public class LoggedInUser { 7 | 8 | private String userId; 9 | private String displayName; 10 | 11 | public LoggedInUser(String userId, String displayName) { 12 | this.userId = userId; 13 | this.displayName = displayName; 14 | } 15 | 16 | public String getUserId() { 17 | return userId; 18 | } 19 | 20 | public String getDisplayName() { 21 | return displayName; 22 | } 23 | } -------------------------------------------------------------------------------- /MyFirstApplication/app/src/main/java/com/example/myfirstapplication/ui/login/LoggedInUserView.java: -------------------------------------------------------------------------------- 1 | package com.example.myfirstapplication.ui.login; 2 | 3 | /** 4 | * Class exposing authenticated user details to the UI. 5 | */ 6 | class LoggedInUserView { 7 | private String displayName; 8 | //... other data fields that may be accessible to the UI 9 | 10 | LoggedInUserView(String displayName) { 11 | this.displayName = displayName; 12 | } 13 | 14 | String getDisplayName() { 15 | return displayName; 16 | } 17 | } -------------------------------------------------------------------------------- /MyFirstApplication/app/src/main/java/com/example/myfirstapplication/ui/login/LoginResult.java: -------------------------------------------------------------------------------- 1 | package com.example.myfirstapplication.ui.login; 2 | 3 | import androidx.annotation.Nullable; 4 | 5 | /** 6 | * Authentication result : success (user details) or error message. 7 | */ 8 | class LoginResult { 9 | @Nullable 10 | private LoggedInUserView success; 11 | @Nullable 12 | private Integer error; 13 | 14 | LoginResult(@Nullable Integer error) { 15 | this.error = error; 16 | } 17 | 18 | LoginResult(@Nullable LoggedInUserView success) { 19 | this.success = success; 20 | } 21 | 22 | @Nullable 23 | LoggedInUserView getSuccess() { 24 | return success; 25 | } 26 | 27 | @Nullable 28 | Integer getError() { 29 | return error; 30 | } 31 | } -------------------------------------------------------------------------------- /MyFirstApplication/app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /MyFirstApplication/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /MyFirstApplication/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /MyFirstApplication/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/MyFirstApplication/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /MyFirstApplication/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/MyFirstApplication/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /MyFirstApplication/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/MyFirstApplication/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /MyFirstApplication/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/MyFirstApplication/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /MyFirstApplication/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/MyFirstApplication/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /MyFirstApplication/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/MyFirstApplication/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /MyFirstApplication/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/MyFirstApplication/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /MyFirstApplication/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/MyFirstApplication/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /MyFirstApplication/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/MyFirstApplication/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /MyFirstApplication/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/MyFirstApplication/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /MyFirstApplication/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | int n = 6; // array size 7 | 8 | int arr[n] = {1 , 3, 7, 8, 10, 13 }; 9 | 10 | int target_sum = 9; 11 | 12 | bool possible = false; 13 | 14 | int i=0; // left pointer 15 | int j=n-1; // right pointer 16 | 17 | while( i < j && i<=n-1 && j >= 0) 18 | { 19 | if( arr[i] + arr[j] > target_sum) 20 | { 21 | j--; 22 | } 23 | else if( arr[i] + arr[j] < target_sum ) 24 | { 25 | i++; 26 | } 27 | else 28 | { 29 | possible = true; 30 | break; 31 | } 32 | 33 | } 34 | 35 | 36 | 37 | if(possible) 38 | { 39 | cout<<"index1 : "< 2 | 3 | 16dp 4 | 16dp 5 | -------------------------------------------------------------------------------- /MyFirstApplication/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | My First Application 3 | LoginActivity 4 | Email 5 | Password 6 | Sign in or register 7 | Sign in 8 | "Welcome !" 9 | Not a valid username 10 | Password must be >5 characters 11 | "Login failed" 12 | -------------------------------------------------------------------------------- /MyFirstApplication/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | -------------------------------------------------------------------------------- /MyFirstApplication/app/src/test/java/com/example/myfirstapplication/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.example.myfirstapplication; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /MyFirstApplication/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | buildscript { 3 | repositories { 4 | google() 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath "com.android.tools.build:gradle:4.0.1" 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | google() 18 | jcenter() 19 | } 20 | } 21 | 22 | task clean(type: Delete) { 23 | delete rootProject.buildDir 24 | } -------------------------------------------------------------------------------- /MyFirstApplication/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/MyFirstApplication/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /MyFirstApplication/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Oct 26 09:15:24 PKT 2020 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip 7 | -------------------------------------------------------------------------------- /MyFirstApplication/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | rootProject.name = "My First Application" -------------------------------------------------------------------------------- /Nth prime number.c: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include 4 | #include 5 | void prime(int m); 6 | void main() 7 | { 8 | int n; 9 | printf("Enter nth="); 10 | scanf("%d",&n); 11 | prime(n); 12 | } 13 | void prime(int n) 14 | { 15 | int count=1,j,i,flag; 16 | if(n==1) 17 | { 18 | printf("prime no is 2 "); 19 | return; 20 | } 21 | for( j=3;j<=10000;j++) 22 | { 23 | for(i=2,flag=0;i<=sqrt(j);i++) 24 | { 25 | if(j%i==0) 26 | { 27 | flag=1; 28 | break; 29 | } 30 | } 31 | if(flag==0) 32 | { 33 | count++; 34 | } 35 | if(count==n) 36 | { 37 | printf("Prime number=%d\n",j); 38 | break;//since its within the j loop without the break statement 39 | //it keeps printing up until the next prime number 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /POW(x,n) USING java: -------------------------------------------------------------------------------- 1 | class GFG { 2 | static int power(int x, int y) 3 | { 4 | if (y == 0) 5 | return 1; 6 | else if (y % 2 == 0) 7 | return power(x, y / 2) * power(x, y / 2); 8 | else 9 | return x * power(x, y / 2) * power(x, y / 2); 10 | } 11 | 12 | public static void main(String[] args) 13 | { 14 | int x = 2; 15 | int y = 3; 16 | 17 | System.out.printf("%d", power(x, y)); 18 | } 19 | } 20 | 21 | -------------------------------------------------------------------------------- /Prime number or not.cpp: -------------------------------------------------------------------------------- 1 | /* This program is to find that given number is prim or not*/ 2 | 3 | #include 4 | using namespace std; 5 | 6 | int main() 7 | { 8 | int no,i; 9 | 10 | cout<<"Enter a number"; 11 | cin>>no; 12 | 13 | for(i=2;i<=no;i++){ 14 | 15 | if(no%i==0) 16 | { 17 | 18 | break; 19 | } 20 | 21 | } 22 | if(i==no) 23 | { 24 | cout<<"Number is a prime number"; 25 | 26 | 27 | } 28 | else 29 | { 30 | cout<<"Number is not a prime number"; 31 | 32 | 33 | } 34 | 35 | 36 | 37 | return 0; 38 | } 39 | 40 | -------------------------------------------------------------------------------- /Prime-number.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | int loop, number; 5 | int prime = 1; 6 | 7 | number = 11; 8 | 9 | for(loop = 2; loop < number; loop++) { 10 | if((number % loop) == 0) { 11 | prime = 0; 12 | } 13 | } 14 | 15 | if (prime == 1) 16 | printf("%d is prime number.", number); 17 | else 18 | printf("%d is not a prime number.", number); 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /Productofarrayexceptitself.cpp: -------------------------------------------------------------------------------- 1 | class Solution { 2 | public: 3 | vector productExceptSelf(vector& nums) { 4 | vector op; 5 | int prod =1; 6 | int is_zero = 0; 7 | for(auto it: nums){ 8 | if(it!=0) 9 | prod *= it; 10 | else 11 | is_zero ++; 12 | } 13 | 14 | for(auto it: nums){ 15 | if(it==0){ 16 | if(is_zero >1) op.push_back(0); 17 | else op.push_back(prod); 18 | }else if(it!=0 && is_zero!=0){ 19 | op.push_back(0); 20 | }else{ 21 | op.push_back(prod/it); 22 | } 23 | } 24 | 25 | return op; 26 | } 27 | }; 28 | -------------------------------------------------------------------------------- /Program to Store and Display Information Using Structure: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | struct student 5 | { 6 | char name[50]; 7 | int roll; 8 | float marks; 9 | } s[10]; 10 | 11 | int main() 12 | { 13 | cout << "Enter information of students: " << endl; 14 | 15 | // storing information 16 | for(int i = 0; i < 10; ++i) 17 | { 18 | s[i].roll = i+1; 19 | cout << "For roll number" << s[i].roll << "," << endl; 20 | 21 | cout << "Enter name: "; 22 | cin >> s[i].name; 23 | 24 | cout << "Enter marks: "; 25 | cin >> s[i].marks; 26 | 27 | cout << endl; 28 | } 29 | 30 | cout << "Displaying Information: " << endl; 31 | 32 | // Displaying information 33 | for(int i = 0; i < 10; ++i) 34 | { 35 | cout << "\nRoll number: " << i+1 << endl; 36 | cout << "Name: " << s[i].name << endl; 37 | cout << "Marks: " << s[i].marks << endl; 38 | } 39 | 40 | return 0; 41 | } 42 | -------------------------------------------------------------------------------- /Pyramid.c: -------------------------------------------------------------------------------- 1 | //C program to print the pyramid pattern 2 | #include 3 | #include 4 | 5 | int main() 6 | { 7 | int i,j; 8 | for(i=1; i<=5; i++) 9 | { 10 | for(j=1; j<=9; j++) 11 | { 12 | if(j>=6-i && j<=4+i) 13 | { 14 | printf("*"); 15 | } 16 | else 17 | { 18 | printf(" "); 19 | } 20 | 21 | } 22 | printf("\n"); 23 | } 24 | getch(); 25 | } 26 | -------------------------------------------------------------------------------- /Pyramid_patern.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Pyramid_patern.cpp -------------------------------------------------------------------------------- /Quick Sort: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | void swap(int *x,int *y) 4 | { 5 | int temp=*x; 6 | *x=*y; 7 | *y=temp; 8 | } 9 | int partition(int A[],int l,int h) 10 | { 11 | int pivot=A[l]; 12 | int i=l,j=h; 13 | 14 | do 15 | { 16 | do{i++;}while(A[i]<=pivot); 17 | do{j--;}while(A[j]>pivot); 18 | 19 | if(ipivot] 9 | return quicksort(left)+middle+quicksort(right) 10 | 11 | 12 | #example 13 | arr=[2,5,1,0,6,-1,2] 14 | sorted_arr = quicksort(arr) 15 | print("Sorted arr is",sorted_arr) -------------------------------------------------------------------------------- /Random List generator Python.py: -------------------------------------------------------------------------------- 1 | import random 2 | randomlist = [] 3 | for i in range(0,5): 4 | n = random.randint(1,30) 5 | randomlist.append(n) 6 | print(randomlist) 7 | -------------------------------------------------------------------------------- /Reverse_prefix.cpp: -------------------------------------------------------------------------------- 1 | // So;ution to a classical leetcode problem 2 | // https://leetcode.com/problems/reverse-prefix-of-word/ 3 | 4 | class Solution { 5 | public: 6 | string reversePrefix(string word, char ch) { 7 | string r=""; 8 | int i,j; 9 | size_t found = word.find(ch); 10 | if(found==string::npos){ 11 | return word; 12 | } 13 | for(i=0;i<=found;i++){ 14 | r+=word[i]; 15 | } 16 | reverse(r.begin(),r.end()); 17 | for(j=i;j 2 | using namespace std; 3 | 4 | class node{ 5 | public: 6 | int data; 7 | node* next; 8 | 9 | node(int val){ 10 | data=val; 11 | next=NULL; 12 | } 13 | }; 14 | void insertAtTail(node* &head, int val){ 15 | node* n= new node(val); 16 | if(head==NULL){ 17 | head=n; 18 | return; 19 | } 20 | 21 | node* temp=head; 22 | while(temp->next!=NULL){ 23 | temp=temp->next; 24 | } 25 | temp->next=n; 26 | } 27 | void display(node* head){ 28 | node* temp=head; 29 | while(temp!=NULL){ 30 | cout<data<<"->"; 31 | temp=temp->next; 32 | } 33 | cout<<"NULL"< 2 | void selection(int arr[], int n){ 3 | int i, j, small; 4 | for (i = 0; i < n - 1; i++){ 5 | small = i; 6 | for (j = i + 1; j < n; j++) 7 | if (arr[j] < arr[small]) 8 | small = j; 9 | int temp = arr[small]; 10 | arr[small] = arr[i]; 11 | arr[i] = temp; 12 | } 13 | } 14 | void printArr(int a[], int n){ 15 | int i; 16 | for (i = 0; i < n; i++) 17 | printf("%d ", a[i]); 18 | } 19 | int main(){ 20 | int a[] = { 12, 31, 25, 8, 32, 17 }; 21 | int n = sizeof(a) / sizeof(a[0]); 22 | 23 | printf("Before sorting array elements are - \n"); 24 | printArr(a, n); 25 | 26 | selection(a, n); 27 | 28 | printf("\nAfter sorting array elements are - \n"); 29 | printArr(a, n); 30 | 31 | return 0; 32 | } 33 | -------------------------------------------------------------------------------- /Sorting Algorithms Using C/Bubble sort using C.txt: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int arr[10], a, b, n; 6 | printf("How many elements do you wish to enter?\n"); 7 | scanf("%d", &n); 8 | printf("What are your %d elements of choice?\n", n); 9 | for(a=0;a arr[b+1]) 18 | { 19 | int temp = arr[b]; 20 | arr[b] = arr[b+1]; 21 | arr[b+1] = temp; 22 | } 23 | 24 | } 25 | 26 | printf("\nThe array after bubble sorting: "); 27 | for(a = 0; a < n; ++a) 28 | printf("%d ", arr[a]); 29 | 30 | return 0; 31 | } -------------------------------------------------------------------------------- /Sorting Algorithms Using C/Insertion sort using C.txt: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | int n, i, j, temp; 5 | int arr[10]; 6 | 7 | printf("How many elements do you wish to enter?\n"); 8 | scanf("%d", &n); 9 | 10 | printf("\nWhat are your %d elements of choice?\n", n); 11 | for (i = 0; i < n; i++) 12 | { 13 | scanf("%d", &arr[i]); 14 | } 15 | for (i = 1 ; i <= n - 1; i++) 16 | { 17 | j = i; 18 | while ( j > 0 && arr[j-1] > arr[j]) 19 | { 20 | temp = arr[j]; 21 | arr[j] = arr[j-1]; 22 | arr[j-1] = temp; 23 | j--; 24 | } 25 | } 26 | printf("\nThe list after insertion sorting: \n"); 27 | for (i = 0; i <= n - 1; i++) 28 | { 29 | printf("%d\n", arr[i]); 30 | } 31 | return 0; 32 | } -------------------------------------------------------------------------------- /Sorting Algorithms Using C/Tower of Hanoi using C.txt: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void towers(int, char, char, char); 4 | 5 | int main() 6 | { 7 | int num; 8 | 9 | printf("Enter the number of disks : "); 10 | scanf("%d", &num); 11 | printf("The sequence of moves involved in the Tower of Hanoi are :\n"); 12 | towers(num, 'A', 'C', 'B'); 13 | return 0; 14 | } 15 | void towers(int num, char frompeg, char topeg, char auxpeg) 16 | { 17 | if (num == 1) 18 | { 19 | printf("\n Move disk 1 from peg %c to peg %c", frompeg, topeg); 20 | return; 21 | } 22 | towers(num - 1, frompeg, auxpeg, topeg); 23 | printf("\n Move disk %d from peg %c to peg %c", num, frompeg, topeg); 24 | towers(num - 1, auxpeg, topeg, frompeg); 25 | } -------------------------------------------------------------------------------- /Sovam/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Sovam/1.png -------------------------------------------------------------------------------- /Sovam/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Sovam/2.png -------------------------------------------------------------------------------- /Sovam/4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Sovam/4.jpg -------------------------------------------------------------------------------- /Sovam/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Sovam/4.png -------------------------------------------------------------------------------- /Sovam/cast.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Sovam/cast.jpg -------------------------------------------------------------------------------- /Sovam/cast.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Sovam/cast.png -------------------------------------------------------------------------------- /Sovam/change.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Sovam/change.png -------------------------------------------------------------------------------- /Space Invaders/Missle_Launch-Kibblesbob-2118796725.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Space Invaders/Missle_Launch-Kibblesbob-2118796725.mp3 -------------------------------------------------------------------------------- /Space Invaders/Missle_Launch-Kibblesbob-2118796725.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Space Invaders/Missle_Launch-Kibblesbob-2118796725.wav -------------------------------------------------------------------------------- /Space Invaders/Scary Scream-SoundBible.com-1115384336.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Space Invaders/Scary Scream-SoundBible.com-1115384336.mp3 -------------------------------------------------------------------------------- /Space Invaders/Yellow Rabbit - Personal Use.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Space Invaders/Yellow Rabbit - Personal Use.otf -------------------------------------------------------------------------------- /Space Invaders/Yellow-Rabbit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Space Invaders/Yellow-Rabbit.png -------------------------------------------------------------------------------- /Space Invaders/alien.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Space Invaders/alien.png -------------------------------------------------------------------------------- /Space Invaders/back.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Space Invaders/back.jpg -------------------------------------------------------------------------------- /Space Invaders/background_music.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Space Invaders/background_music.wav -------------------------------------------------------------------------------- /Space Invaders/bullet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Space Invaders/bullet.png -------------------------------------------------------------------------------- /Space Invaders/death.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Space Invaders/death.png -------------------------------------------------------------------------------- /Space Invaders/explosion.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Space Invaders/explosion.wav -------------------------------------------------------------------------------- /Space Invaders/fire_sound.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Space Invaders/fire_sound.wav -------------------------------------------------------------------------------- /Space Invaders/rocket image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/Space Invaders/rocket image.png -------------------------------------------------------------------------------- /SpiralPrintMatrix.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main(){ 3 | int a[100][100],i,j,l,n=5,k=0,m=5,top,rig,bot,lef; //can assign custom values to n,k,m,size of array 4 | for(i=0;i=lef;j--) 28 | { 29 | printf("%d ",a[bot][j]); 30 | } 31 | bot--; 32 | for(j=bot;j>=top;j--) 33 | { 34 | printf("%d ",a[j][lef]); 35 | } 36 | lef++; 37 | 38 | 39 | } 40 | 41 | 42 | } 43 | -------------------------------------------------------------------------------- /String_Reversal: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | void main() 4 | { 5 | int i, j, k,n; 6 | scanf("%d\n",&n); 7 | char str[n]; 8 | char rev_str[n]; 9 | printf("Enter a string:\t"); 10 | scanf("%s", str); 11 | printf("The original string is %s\n", str); 12 | for(i = 0; str[i] != '\0'; i++); 13 | { 14 | k = i-1; 15 | } 16 | for(j = 0; j <= i-1; j++) 17 | { 18 | rev_str[j] = str[k]; 19 | k--; 20 | } 21 | printf("The reverse string is %s\n", rev_str); 22 | } 23 | -------------------------------------------------------------------------------- /Sum of array elements.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main(){ 4 | int size; 5 | cin>>size; 6 | int arr[size]; 7 | for(int i=0;i>arr[i]; 9 | } 10 | int sum=0; 11 | for(int i=0;i 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | int a = 5, b = 10, temp; 7 | 8 | cout << "Before swapping." << endl; 9 | cout << "a = " << a << ", b = " << b << endl; 10 | 11 | temp = a; 12 | a = b; 13 | b = temp; 14 | 15 | cout << "\nAfter swapping." << endl; 16 | cout << "a = " << a << ", b = " << b << endl; 17 | 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /Swap two numbers without using a third variable.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | void swap(int , int ); 6 | 7 | int main() 8 | { 9 | int x,y; 10 | cout<<"Enter number x:"<>x; 12 | cout<<"Enter number y:"<>y; 14 | swap(x,y); 15 | return 0; 16 | } 17 | 18 | void swap ( int a, int b) 19 | { 20 | a = a + b; 21 | b = a - b; 22 | a = a - b; 23 | printf("\nAfter swapping: x = %d and y = %d\n", a, b); 24 | } 25 | -------------------------------------------------------------------------------- /Swap_word.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | int main() 4 | { 5 | char first[100], second[100], t[100]; 6 | 7 | printf("Enter first string\n"); 8 | gets(first); 9 | 10 | printf("Enter second string\n"); 11 | gets(second); 12 | 13 | printf("\nBefore Swapping\n"); 14 | printf("First string: %s\n", first); 15 | printf("Second string: %s\n\n", second); 16 | 17 | strcpy(t, first); 18 | strcpy(first, second); 19 | strcpy(second, t); 20 | 21 | printf("After Swapping\n"); 22 | printf("First string: %s\n", first); 23 | printf("Second string: %s\n", second); 24 | 25 | return 0; 26 | } 27 | -------------------------------------------------------------------------------- /Swaptwonumber.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | 5 | double first, second, temp; 6 | 7 | printf("Enter first number: "); 8 | 9 | scanf("%lf", &first); 10 | 11 | printf("Enter second number: "); 12 | 13 | scanf("%lf", &second); 14 | 15 | // value of first is assigned to temp 16 | 17 | temp = first; 18 | 19 | // value of second is assigned to first 20 | 21 | first = second; 22 | 23 | // value of temp (initial value of first) is assigned to second 24 | 25 | second = temp; 26 | 27 | // %.2lf displays number up to 2 decimal points 28 | 29 | printf("\nAfter swapping, first number = %.2lf\n", first); 30 | 31 | printf("After swapping, second number = %.2lf", second); 32 | 33 | return 0; 34 | 35 | } 36 | -------------------------------------------------------------------------------- /Table.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | int i; 7 | int num; 8 | int table; 9 | cout<<"Enter the table which you want = "; 10 | cin>>num; 11 | 12 | for(i=1;i<=10;i++) 13 | { 14 | table=i*num; 15 | cout<1: 3 | for i in range(2,r): 4 | if r%i==0: 5 | print(str(r)+"is not a prime number") 6 | print(str(i)+" time "+str(r//i)+" is "+str(r)) 7 | break 8 | else: 9 | print(str(r)+" is a prime number.") 10 | 11 | else: 12 | print(str(r)+" is negative integer") 13 | print("Now enjoy Hacktoberfest! :D ") 14 | -------------------------------------------------------------------------------- /Tower_of_Hanoi.py: -------------------------------------------------------------------------------- 1 | def TowerOfHanoi(n , source, destination, auxiliary): 2 | if n==1: 3 | print ("Move disk 1 from source",source,"to destination",destination) 4 | return 5 | TowerOfHanoi(n-1, source, auxiliary, destination) 6 | print ("Move disk",n,"from source",source,"to destination",destination) 7 | TowerOfHanoi(n-1, auxiliary, destination, source) 8 | 9 | n = int(input()) 10 | x,y,z=input().split(" ") 11 | 12 | TowerOfHanoi(n,x,y,z) 13 | -------------------------------------------------------------------------------- /Tree Transversal: -------------------------------------------------------------------------------- 1 | 2 | class Node: 3 | def __init__(self, item): 4 | self.left = None 5 | self.right = None 6 | self.val = item 7 | 8 | 9 | def inorder(root): 10 | 11 | if root: 12 | inorder(root.left) 13 | print(str(root.val) + "->", end='') 14 | 15 | inorder(root.right) 16 | 17 | 18 | def postorder(root): 19 | 20 | if root: 21 | postorder(root.left) 22 | postorder(root.right) 23 | print(str(root.val) + "->", end='') 24 | 25 | 26 | def preorder(root): 27 | 28 | if root: 29 | print(str(root.val) + "->", end='') 30 | preorder(root.left) 31 | preorder(root.right) 32 | 33 | 34 | root = Node(1) 35 | root.left = Node(2) 36 | root.right = Node(3) 37 | root.left.left = Node(4) 38 | root.left.right = Node(5) 39 | 40 | print("Inorder traversal ") 41 | inorder(root) 42 | 43 | print("\nPreorder traversal ") 44 | preorder(root) 45 | 46 | print("\nPostorder traversal ") 47 | postorder(root) 48 | -------------------------------------------------------------------------------- /Ugly Numbers: -------------------------------------------------------------------------------- 1 | // C++ program to find nth ugly number 2 | #include 3 | using namespace std; 4 | 5 | // This function divides a by greatest 6 | // divisible power of b 7 | int maxDivide(int a, int b) 8 | { 9 | while (a % b == 0) 10 | a = a / b; 11 | 12 | return a; 13 | } 14 | 15 | // Function to check if a number is ugly or not 16 | int isUgly(int no) 17 | { 18 | no = maxDivide(no, 2); 19 | no = maxDivide(no, 3); 20 | no = maxDivide(no, 5); 21 | 22 | return (no == 1) ? 1 : 0; 23 | } 24 | 25 | // Function to get the nth ugly number 26 | int getNthUglyNo(int n) 27 | { 28 | int i = 1; 29 | 30 | // Ugly number count 31 | int count = 1; 32 | 33 | // Check for all integers untill ugly 34 | // count becomes n 35 | while (n > count) 36 | { 37 | i++; 38 | if (isUgly(i)) 39 | count++; 40 | } 41 | return i; 42 | } 43 | 44 | // Driver Code 45 | int main() 46 | { 47 | 48 | // Function call 49 | unsigned no = getNthUglyNo(150); 50 | cout << "150th ugly no. is " << no; 51 | return 0; 52 | } 53 | 54 | 55 | -------------------------------------------------------------------------------- /advancedcalculator.py: -------------------------------------------------------------------------------- 1 | allowed_symbol = [ 2 | "+", 3 | "-", 4 | "*", 5 | "**", 6 | "/", 7 | "(", 8 | ")", 9 | "e" 10 | ] 11 | 12 | while True: 13 | 14 | for symbol in (expr := input("[*] Enter a calculation\n>>>")): 15 | if not symbol in allowed_symbol and not symbol.isdigit(): 16 | print("That's not a valid calculation!") 17 | exit(1) 18 | 19 | print(eval(expr)) 20 | 21 | if input("[?] Try again? [Yes | No]\n>>>").lower() == "yes": 22 | continue 23 | 24 | break -------------------------------------------------------------------------------- /amstrongnumber.c: -------------------------------------------------------------------------------- 1 | check if it is Armstrong number or not # 2 | #include 3 | #include 4 | 5 | int main() { 6 | int num, originalNum, remainder, n = 0; 7 | float result = 0.0; 8 | 9 | // Input the number 10 | printf("Enter an integer: "); 11 | scanf("%d", &num); 12 | 13 | originalNum = num; 14 | 15 | // Find the number of digits 16 | while (originalNum != 0) { 17 | originalNum /= 10; 18 | ++n; 19 | } 20 | 21 | originalNum = num; 22 | 23 | // Calculate the sum of powers of digits 24 | while (originalNum != 0) { 25 | remainder = originalNum % 10; 26 | result += pow(remainder, n); 27 | originalNum /= 10; 28 | } 29 | 30 | // Check if the number is an Armstrong number 31 | if ((int)result == num) 32 | printf("%d is an Armstrong number.\n", num); 33 | else 34 | printf("%d is not an Armstrong number.\n", num); 35 | 36 | return 0; 37 | } 38 | -------------------------------------------------------------------------------- /anagram_sub_string.js: -------------------------------------------------------------------------------- 1 | 2 | let w = 'abx'; 3 | let S = 'abxaba'; 4 | 5 | let holdWords = S.split(""); 6 | 7 | for(let i = 0; i < holdWords.length; i++) { 8 | let currWord = holdWords.slice(i,i + w.length).join(""); 9 | 10 | if(currWord.split("").sort().join("") == w.split("").sort().join("")) { 11 | console.log("Current Word Is Anagram") 12 | console.log(currWord); 13 | console.log(i) 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /arithmetic_kushagra.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | int a,b,temp; 6 | cout<<"Enter 2 numbers\n"; 7 | cin>>a>>b; 8 | cout<<" MENU \n"; 9 | cout<<"Press 1. for Addition\nPress 2. for Subtraction\nPress 3. for Division\nPress 4. for Multiplpcation\n"; 10 | cin>>temp; 11 | switch(temp) 12 | { 13 | case 1: cout<<"Result :"< 5 | 6 | void main() 7 | { 8 | int num,t,sum=0,cube=1,r; 9 | 10 | printf("Enter number: "); 11 | scanf("%d", &num); 12 | t=num; 13 | while(num!=0){ 14 | 15 | r = num%10; 16 | cube = r*r*r; 17 | num/=10; 18 | sum=sum+cube; 19 | 20 | } 21 | if(t==sum){ 22 | printf("Armstrong Number"); 23 | } 24 | else{ 25 | printf("Not Armstrong Number"); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /aws event source mapping: -------------------------------------------------------------------------------- 1 | { 2 | "UUID": "14e0db71-5d35-4eb5-b481-8945cf9d10c2", 3 | "BatchSize": 500, 4 | "MaximumBatchingWindowInSeconds": 0, 5 | "ParallelizationFactor": 1, 6 | "EventSourceArn": "arn:aws:dynamodb:us-east-2:123456789012:table/my-table/stream/2019-06-10T19:26:16.525", 7 | "FunctionArn": "arn:aws:lambda:us-east-2:123456789012:function:my-function", 8 | "LastModified": 1560209851.963, 9 | "LastProcessingResult": "No records processed", 10 | "State": "Creating", 11 | "StateTransitionReason": "User action", 12 | "DestinationConfig": {}, 13 | "MaximumRecordAgeInSeconds": 604800, 14 | "BisectBatchOnFunctionError": false, 15 | "MaximumRetryAttempts": 10000 16 | } 17 | -------------------------------------------------------------------------------- /binary search with recursion.py: -------------------------------------------------------------------------------- 1 | def binary_search(alist, start, end, key): 2 | """Search key in alist[start... end - 1].""" 3 | if not start < end: 4 | return -1 5 | 6 | mid = (start + end)//2 7 | if alist[mid] < key: 8 | return binary_search(alist, mid + 1, end, key) 9 | elif alist[mid] > key: 10 | return binary_search(alist, start, mid, key) 11 | else: 12 | return mid 13 | 14 | 15 | alist = input('Enter the sorted list of numbers: ') 16 | alist = alist.split() 17 | alist = [int(x) for x in alist] 18 | key = int(input('The number to search for: ')) 19 | 20 | index = binary_search(alist, 0, len(alist), key) 21 | if index < 0: 22 | print('{} was not found.'.format(key)) 23 | else: 24 | print('{} was found at index {}.'.format(key, index)) -------------------------------------------------------------------------------- /binary-list-generator.py: -------------------------------------------------------------------------------- 1 | # Necro(ネクロ) 2 | # sidmishra94540@gmail.com 3 | 4 | def binaryGenerator(n): 5 | pad = [0]*n 6 | res = [] 7 | for _ in range(2**n): 8 | num = list(map(int, bin(_)[2:])) 9 | num = pad[:n-len(num)]+num 10 | res.append(num) 11 | return res 12 | if __name__ == '__main__': 13 | print(binaryGenerator(int(input()))) -------------------------------------------------------------------------------- /binaryEquivalent.c: -------------------------------------------------------------------------------- 1 | #include 2 | void main() 3 | { 4 | int a[100], j, i = 0, n, r; 5 | printf("enter the no in decimal equivalent"); 6 | { 7 | scanf("%d", &n); 8 | } 9 | while (n != 0) 10 | { 11 | r = n % 2; 12 | a[i] = r; 13 | n = n / 2; 14 | i++; 15 | } 16 | for (j = i - 1; j >= 0; j--) 17 | { 18 | printf("%d", a[j]); 19 | } 20 | // printf("binary equivalent is %d", a[j]); 21 | } -------------------------------------------------------------------------------- /binary_bucket_sort.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Function to sort an array in binary buckets (2-radix sort) 3 | ''' 4 | 5 | def bin_bucket_sort(arr): 6 | """ 7 | Binary bucket sort / 2-Radix sort 8 | Time: O(NLog2N) 9 | Space: O(N) 10 | 11 | input: 1D-list array 12 | output: 1D-list sorted array 13 | """ 14 | bucket = [[], []] 15 | aux = list(arr) 16 | flgkey = 1 17 | 18 | while True: 19 | for ele in aux: 20 | bucket[int(bool(ele & flgkey))].append(ele) 21 | if bucket[0] == [] or bucket[1] == []: 22 | return aux 23 | aux = list(bucket[0]) + list(bucket[1]) 24 | flgkey <<= 1 25 | bucket = [[], []] 26 | 27 | 28 | print("Hello To my first program") 29 | l1 = [1, 4, 2, 3, 5, 2, 5, 2] 30 | print(bin_bucket_sort(l1)) -------------------------------------------------------------------------------- /c++ problems asked in interview/1137. N-th Tribonacci Number.cpp: -------------------------------------------------------------------------------- 1 | The Tribonacci sequence Tn is defined as follows: 2 | 3 | T0 = 0, T1 = 1, T2 = 1, and Tn+3 = Tn + Tn+1 + Tn+2 for n >= 0. 4 | 5 | Given n, return the value of Tn. 6 | 7 | Example 1: 8 | 9 | Input: n = 4 10 | Output: 4 11 | Explanation: 12 | T_3 = 0 + 1 + 1 = 2 13 | T_4 = 1 + 1 + 2 = 4 14 | Example 2: 15 | 16 | Input: n = 25 17 | Output: 1389537 18 | 19 | 20 | Constraints: 21 | 22 | 0 <= n <= 37 23 | The answer is guaranteed to fit within a 32-bit integer, ie. answer <= 2^31 - 1. 24 | 25 | Solution : 26 | Time Complexity = O(3^n) 27 | 28 | class Solution { 29 | int dp[38]={0,1,1}; 30 | public: 31 | int tribonacci(int n) { 32 | if (!n || dp[n]) return dp[n]; //base class 33 | else 34 | return dp[n] = tribonacci(n-1)+tribonacci(n-2)+tribonacci(n-3); 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /c++ problems asked in interview/118. Pascal's Triangle.cpp: -------------------------------------------------------------------------------- 1 | Given an integer numRows, return the first numRows of Pascal's triangle. 2 | 3 | In Pascal's triangle, each number is the sum of the two numbers directly above it as shown: 4 | 5 | Example 1: 6 | 7 | Input: numRows = 5 8 | Output: [[1],[1,1],[1,2,1],[1,3,3,1],[1,4,6,4,1]] 9 | Example 2: 10 | 11 | Input: numRows = 1 12 | Output: [[1]] 13 | 14 | Solution : 15 | 16 | Time Complexity : O(n*n) 17 | 18 | class Solution { 19 | public: 20 | vector> generate(int numRows) { 21 | vector>res(numRows); 22 | 23 | for(int i=0;i runningSum(vector& nums) { 25 | for(int i=1;i& indices) { 18 | string res = s; 19 | for(int i=0;ival==val) //if value matches 24 | return removeElements(head->next,val); //just ignore the element node 25 | else 26 | { 27 | head->next = removeElements(head->next,val); 28 | } 29 | return head; 30 | } 31 | }; 32 | -------------------------------------------------------------------------------- /c++ problems asked in interview/206. Reverse Linked List.cpp: -------------------------------------------------------------------------------- 1 | Given the head of a singly linked list, reverse the list, and return the reversed list. 2 | 3 | Example 1: 4 | Input: head = [1,2,3,4,5] 5 | Output: [5,4,3,2,1] 6 | 7 | Example 2: 8 | 9 | Input: head = [1,2] 10 | Output: [2,1] 11 | Example 3: 12 | 13 | Input: head = [] 14 | Output: [] 15 | 16 | Solution : 17 | Time Complexity : O(n) 18 | Space Complexity : O(n) where n is the size of the linkedlist 19 | 20 | class Solution { 21 | public: 22 | ListNode* reverseList(ListNode* head) { 23 | vectorres; 24 | ListNode* temp = head; 25 | while(temp) 26 | { 27 | res.push_back(temp->val); 28 | temp = temp->next; 29 | } 30 | 31 | temp = head; 32 | 33 | for(int i=res.size()-1; i>=0;i--) 34 | { 35 | temp->val = res[i]; 36 | temp =temp->next; 37 | } 38 | return head; 39 | } 40 | }; 41 | -------------------------------------------------------------------------------- /c++ problems asked in interview/215. Kth Largest Element in an Array.cpp: -------------------------------------------------------------------------------- 1 | Given an integer array nums and an integer k, return the kth largest element in the array. 2 | Note that it is the kth largest element in the sorted order, not the kth distinct element. 3 | Example 1: 4 | 5 | Input: nums = [3,2,1,5,6,4], k = 2 6 | Output: 5 7 | Example 2: 8 | 9 | Input: nums = [3,2,3,1,2,4,5,5,6], k = 4 10 | Output: 4 11 | 12 | Solution: 13 | 14 | class Solution { 15 | public: 16 | int findKthLargest(vector& nums, int k) { 17 | sort(nums.begin(),nums.end()); 18 | int n = nums.size(); 19 | return nums[n-k]; 20 | } 21 | }; 22 | -------------------------------------------------------------------------------- /c++ problems asked in interview/226. Invert Binary Tree.cpp: -------------------------------------------------------------------------------- 1 | Given the root of a binary tree, invert the tree, and return its root. 2 | 3 | Example 1: 4 | 5 | Input: root = [4,2,7,1,3,6,9] 6 | Output: [4,7,2,9,6,3,1] 7 | Example 2: 8 | 9 | 10 | Input: root = [2,1,3] 11 | Output: [2,3,1] 12 | Example 3: 13 | 14 | Input: root = [] 15 | Output: [] 16 | 17 | Solution : 18 | 19 | Time Complexity - O(N) where N is the number of elements present in the tree. 20 | Space Complexity - O(1) because we are not using any extra space. 21 | 22 | class Solution { 23 | public: 24 | TreeNode* invertTree(TreeNode* root) { 25 | if(root) 26 | { 27 | invertTree(root->left); 28 | invertTree(root->right); 29 | swap(root->left,root->right); 30 | } 31 | return root; 32 | } 33 | }; 34 | 35 | This is a recursive approach. 36 | -------------------------------------------------------------------------------- /c++ problems asked in interview/31. Next Permutation.cpp: -------------------------------------------------------------------------------- 1 | Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. 2 | 3 | If such an arrangement is not possible, it must rearrange it as the lowest possible order (i.e., sorted in ascending order). 4 | 5 | The replacement must be in place and use only constant extra memory. 6 | 7 | 8 | Example 1: 9 | 10 | Input: nums = [1,2,3] 11 | Output: [1,3,2] 12 | Example 2: 13 | 14 | Input: nums = [3,2,1] 15 | Output: [1,2,3] 16 | Example 3: 17 | 18 | Input: nums = [1,1,5] 19 | Output: [1,5,1] 20 | Example 4: 21 | 22 | Input: nums = [1] 23 | Output: [1] 24 | 25 | Solution : 26 | 27 | class Solution { 28 | public: 29 | void nextPermutation(vector& nums) { 30 | next_permutation(nums.begin(),nums.end()); 31 | } 32 | }; 33 | 34 | Time Complexity : O(n) 35 | -------------------------------------------------------------------------------- /c++ problems asked in interview/383. Ransom Note.cpp: -------------------------------------------------------------------------------- 1 | Given two stings ransomNote and magazine, return true if ransomNote can be constructed from magazine and false otherwise. 2 | 3 | Each letter in magazine can only be used once in ransomNote. 4 | Example 1: 5 | 6 | Input: ransomNote = "a", magazine = "b" 7 | Output: false 8 | Example 2: 9 | 10 | Input: ransomNote = "aa", magazine = "ab" 11 | Output: false 12 | Example 3: 13 | 14 | Input: ransomNote = "aa", magazine = "aab" 15 | Output: true 16 | 17 | Solution : O(n) where n is the length of the string 18 | 19 | class Solution { 20 | public: 21 | bool canConstruct(string ransomNote, string magazine) { 22 | int count[26] = {0}; //to store count of each alphabet 23 | for(char ch:magazine) 24 | count[ch-'a']++; 25 | 26 | for(char ch : ransomNote) 27 | if(count[ch-'a']-- <=0) 28 | return false; 29 | 30 | return true; 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /c++ problems asked in interview/503. Next Greater Element II.cpp: -------------------------------------------------------------------------------- 1 | class Solution { 2 | public: 3 | vector nextGreaterElements(vector& nums) { 4 | stackst; 5 | int n=nums.size(); 6 | vectornge(2*n); 7 | for(int i=2*n-1;i>=0;i--) 8 | { 9 | if(st.empty()) 10 | nge[i]=-1; 11 | else 12 | { 13 | while(st.empty()==false && st.top()<=nums[i%n]) 14 | st.pop(); 15 | if(st.empty()) 16 | nge[i]=-1; 17 | else 18 | nge[i]=st.top(); 19 | } 20 | st.push(nums[i%n]); 21 | } 22 | vectorvec; 23 | for(int i=0;i 1. 5 | Given n, calculate F(n). 6 | 7 | Solution : (using recursion) 8 | 9 | class Solution { 10 | public: 11 | int fib(int n) { 12 | if(n==0) 13 | return 0; 14 | if(n==1) 15 | return 1; 16 | else return fib(n-1)+fib(n-2); 17 | } 18 | }; 19 | -------------------------------------------------------------------------------- /c++ problems asked in interview/509. Fibonacci Number.cpp: -------------------------------------------------------------------------------- 1 | The Fibonacci numbers, commonly denoted F(n) form a sequence, called the Fibonacci sequence, such that each number is the sum of the two preceding ones, 2 | starting from 0 and 1. That is, 3 | 4 | F(0) = 0, F(1) = 1 5 | F(n) = F(n - 1) + F(n - 2), for n > 1. 6 | Given n, calculate F(n). 7 | 8 | 9 | Example 1: 10 | 11 | Input: n = 2 12 | Output: 1 13 | Explanation: F(2) = F(1) + F(0) = 1 + 0 = 1. 14 | Example 2: 15 | 16 | Input: n = 3 17 | Output: 2 18 | Explanation: F(3) = F(2) + F(1) = 1 + 1 = 2. 19 | Example 3: 20 | 21 | Input: n = 4 22 | Output: 3 23 | Explanation: F(4) = F(3) + F(2) = 2 + 1 = 3. 24 | 25 | Solution : 26 | Time Complexity - T(n) = T(n-1) + T(n-2) + 1 = 2^n = O(2^n) which is an exponential form. 27 | 28 | class Solution { 29 | public: 30 | int fib(int n) { 31 | if(n==0 || n==1) 32 | return n; 33 | else 34 | return fib(n-1)+fib(n-2); 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /c++ problems asked in interview/700. Search in a Binary Search Tree.cpp: -------------------------------------------------------------------------------- 1 | You are given the root of a binary search tree (BST) and an integer val. 2 | 3 | Find the node in the BST that the node's value equals val and return the subtree rooted with that node. If such a node does not exist, return null. 4 | 5 | Example 1: 6 | Input: root = [4,2,7,1,3], val = 2 7 | Output: [2,1,3] 8 | Example 2: 9 | 10 | 11 | Input: root = [4,2,7,1,3], val = 5 12 | Output: [] 13 | 14 | Solution : 15 | 16 | Time Complexity - O(N) where N is the number of nodes present in the tree 17 | 18 | Recursive approach 19 | class Solution { 20 | public: 21 | TreeNode* searchBST(TreeNode* root, int val) { 22 | if(root==NULL) 23 | return nullptr; 24 | if(root->val ==val) 25 | return root; 26 | else if(root->val >val) 27 | return searchBST(root->left,val); 28 | else 29 | return searchBST(root->right,val); 30 | } 31 | }; 32 | -------------------------------------------------------------------------------- /c++ problems asked in interview/83. Remove Duplicates from Sorted List.cpp: -------------------------------------------------------------------------------- 1 | Given the head of a sorted linked list, delete all duplicates such that each element appears only once. Return the linked list sorted as well. 2 | 3 | Example 1: 4 | 5 | Input: head = [1,1,2] 6 | Output: [1,2] 7 | Example 2: 8 | 9 | 10 | Input: head = [1,1,2,3,3] 11 | Output: [1,2,3] 12 | 13 | Solution : 14 | 15 | Time Complexity - O(n) 16 | Space Complexity - O(1) 17 | 18 | class Solution { 19 | public: 20 | ListNode* deleteDuplicates(ListNode* head) { 21 | if(head==NULL) 22 | return NULL; 23 | 24 | ListNode* curr = head; 25 | while(curr->next) 26 | { 27 | if(curr->val == curr->next->val) 28 | curr->next = curr->next->next; 29 | else 30 | curr = curr->next; 31 | } 32 | return head; 33 | } 34 | }; 35 | -------------------------------------------------------------------------------- /c++ problems asked in interview/94. Binary Tree Inorder Traversal.cpp: -------------------------------------------------------------------------------- 1 | Given the root of a binary tree, return the inorder traversal of its nodes' values. 2 | 3 | Example 1: 4 | Input: root = [1,null,2,3] 5 | Output: [1,3,2] 6 | Example 2: 7 | 8 | Input: root = [] 9 | Output: [] 10 | Example 3: 11 | 12 | Input: root = [1] 13 | Output: [1] 14 | Example 4: 15 | 16 | 17 | Input: root = [1,2] 18 | Output: [2,1] 19 | Example 5: 20 | 21 | 22 | Input: root = [1,null,2] 23 | Output: [1,2] 24 | 25 | Solution : Time & Space Complexity - O(n) where n is the number of nodes in the binary search tree. 26 | 27 | class Solution { 28 | public: 29 | vectorans; 30 | vector inorderTraversal(TreeNode* root) { 31 | if(root==NULL) 32 | return ans; 33 | 34 | inorderTraversal(root->left); 35 | ans.push_back(root->val); 36 | inorderTraversal(root->right); 37 | 38 | return ans; 39 | } 40 | }; 41 | -------------------------------------------------------------------------------- /c++ problems asked in interview/Binary Search(GFG).cpp: -------------------------------------------------------------------------------- 1 | Given a sorted array of size N and an integer K, find the position at which K is present in the array using binary search. 2 | 3 | 4 | Example 1: 5 | 6 | Input: 7 | N = 5 8 | arr[] = {1 2 3 4 5} 9 | K = 4 10 | Output: 3 11 | Explanation: 4 appears at index 3. 12 | 13 | Solution : 14 | 15 | class Solution{ 16 | public: 17 | int binarysearch(int arr[], int n, int k){ 18 | int start = 0 , end = n-1 , mid =0; 19 | while(start<=end) 20 | { 21 | mid = (start+end)/2; 22 | 23 | if(arr[mid]==k) 24 | return mid; 25 | 26 | else if(k>arr[mid]) 27 | start = mid+1; 28 | 29 | else 30 | end = mid-1; 31 | } 32 | return -1; 33 | } 34 | }; 35 | -------------------------------------------------------------------------------- /c++ problems asked in interview/CODEONFEST-Program - Shortcut.lnk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/c++ problems asked in interview/CODEONFEST-Program - Shortcut.lnk -------------------------------------------------------------------------------- /c++ problems asked in interview/Check set bits(GFG).cpp: -------------------------------------------------------------------------------- 1 | Example 1: 2 | 3 | Input: 4 | N = 7 5 | Output: 6 | 1 7 | Explanation: 8 | Binary for 7 is 111 all the 9 | bits are set so output is 1 10 | Example 2: 11 | 12 | Input: 13 | N = 8 14 | Output: 15 | 0 16 | Explanation: 17 | Binary for 8 is 1000 all the 18 | bits are not set so output is 0. 19 | 20 | Your Task: 21 | You don't need to read input or print anything. Your task is to complete the function isBitSet() which takes an integer N as input parameters and returns 1 if all the bits in N's binary representation is set or return 0 otherwise. 22 | 23 | Expected Time Complexity: O(1) 24 | Expected Space Complexity: O(1) 25 | 26 | Solution : 27 | 28 | class Solution{ 29 | public: 30 | int isBitSet(int n){ 31 | if(n==0) 32 | return 0; 33 | if(((n+1) & n) ==0) 34 | return 1; 35 | return 0; 36 | } 37 | }; 38 | -------------------------------------------------------------------------------- /c++ problems asked in interview/Half N by M(GFG).cpp: -------------------------------------------------------------------------------- 1 | Given two values N and M. Give the value when N is halved M-1 times. 2 | 3 | Example 1: 4 | 5 | Input: N = 100, M = 4 6 | Output: 12 7 | Explaination: The sequence of numbers is 8 | 100, 50, 25, 12. 9 | Example 2: 10 | 11 | Input: N = 10, M = 5 12 | Output: 0 13 | Explaination: The sequence is 10, 5, 2, 1 and 0. 14 | Your Task: 15 | You do not need to read input or print anything. Your task is to complete the function mthHalf() which takes N 16 | and M as input parameters and retunrs the value of N when it is halved M-1 times. 17 | 18 | 19 | Time Complexity: O(1) 20 | Auxiliary Space: O(1) 21 | 22 | Solution : 23 | 24 | class Solution{ 25 | public: 26 | int mthHalf(int N, int M){ 27 | return N/pow(2,M-1); 28 | } 29 | }; 30 | 31 | -------------------------------------------------------------------------------- /c++ problems asked in interview/README.md: -------------------------------------------------------------------------------- 1 | # CODE{ON}FEST-Program 2 | 3 | I am a participant at Code{On}Fest Program. 4 | Here I will upload my code for the questions I solve each day. 5 | -------------------------------------------------------------------------------- /calculator_menu.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | int a,b,temp; 6 | cout<<"Enter 2 numbers\n"; 7 | cin>>a>>b; 8 | cout<<" MENU \n"; 9 | cout<<"Press 1. for Addition\nPress 2. for Subtraction\nPress 3. for Division\nPress 4. for Multiplpcation\n"; 10 | cin>>temp; 11 | switch(temp) 12 | { 13 | case 1: cout<<"Result :"< 2 | void main() 3 | { 4 | int a,b,max; 5 | a=10; 6 | b=20; 7 | max=a>b?a:b; 8 | printf("maximum between these two is %d",max); 9 | 10 | 11 | } 12 | -------------------------------------------------------------------------------- /checkprimenumberthruloop.c: -------------------------------------------------------------------------------- 1 | /* Program to check whether an entered number is prime or not 2 | by using the method of looping */ 3 | 4 | 5 | #include 6 | #include 7 | 8 | void main() 9 | { 10 | int num,i; 11 | printf("\n Enter the number"); 12 | scanf("%d",&num); 13 | { 14 | if(num==1) 15 | {printf("\n 1 is neither a prime nor a composite number");} 16 | } 17 | i=2; 18 | while(i<=num-1) 19 | { 20 | if(num%i==0) 21 | {printf("\n Not a prime number"); 22 | break;} 23 | i++; 24 | 25 | if(i==num) 26 | {printf("\n It is a prime number");} 27 | 28 | } 29 | getch(); 30 | } -------------------------------------------------------------------------------- /comments_and_escape_statements.py: -------------------------------------------------------------------------------- 1 | #single line comment starts 2 | 3 | print("Hello World") 4 | 5 | #single line comment ends 6 | 7 | """Multi 8 | line 9 | comments 10 | """ 11 | 12 | #escape statement starts 13 | 14 | print("Hey there \n How are you?") 15 | 16 | #escape statement ends 17 | -------------------------------------------------------------------------------- /container_with_most_water.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def maxArea(self, H: List[int]) -> int: 3 | ans, i, j = 0, 0, len(H)-1 4 | while (i < j): 5 | if H[i] <= H[j]: 6 | res = H[i] * (j - i) 7 | i += 1 8 | else: 9 | res = H[j] * (j - i) 10 | j -= 1 11 | if res > ans: ans = res 12 | return ans -------------------------------------------------------------------------------- /euler_phi_function.cpp: -------------------------------------------------------------------------------- 1 | #include "bits/stdc++.h" 2 | using namespace std; 3 | typedef long long ll; 4 | const int LIM = 1e6 + 5; 5 | 6 | //Euler Totient's Function 7 | //Time Complexity: O(N logN) 8 | 9 | void phi(){ 10 | ll phi[LIM]; 11 | bool isPrime[LIM]; 12 | 13 | for(int i = 0; i < LIM; i++) 14 | phi[i] = i, isPrime[i] = true; 15 | 16 | for(int i = 2; i < LIM; i++){ 17 | if(isPrime[i]){ 18 | phi[i]--; 19 | for(int j = i*2; j < LIM; j+=i){ 20 | isPrime[j] = false; 21 | phi[j] /= i; 22 | phi[j] *= (i-1); 23 | } 24 | } 25 | } 26 | } 27 | 28 | int main(){ 29 | ios::sync_with_stdio(0); 30 | cin.tie(0); cout.tie(0); 31 | 32 | phi(); 33 | 34 | return 0; 35 | } 36 | -------------------------------------------------------------------------------- /factorial.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | 5 | int n,fact=1; 6 | scanf("%d",&n);//get the integer input from the user 7 | while(n!=0)//checking the condition 8 | { 9 | fact=fact*n; 10 | n--; 11 | } 12 | printf("Factorial of the given integer = %d",fact);//printing the final answer 13 | } -------------------------------------------------------------------------------- /factorial.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/factorial.exe -------------------------------------------------------------------------------- /factorial_recursion.c: -------------------------------------------------------------------------------- 1 | // This is a program to find the factorial of any number using recursion 2 | 3 | #include 4 | int factorial(int number) 5 | { 6 | if (number == 1 || number == 0) 7 | { 8 | return 1; 9 | } 10 | else 11 | { 12 | return (number * factorial(number - 1)); 13 | } 14 | } 15 | int main() 16 | { 17 | int num; 18 | printf("enter the no. you want factorial of\n"); 19 | scanf("%d", &num); 20 | printf("the factorial of %d is %d\n", num, factorial(num)); 21 | 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /fibonacci series: -------------------------------------------------------------------------------- 1 | #include 2 | int fibonacci(int i){ 3 | if (i==0) 4 | return 0; 5 | 6 | if(i==1) 7 | return 1; 8 | 9 | else 10 | return(fibonacci(i-1)+fibonacci(i-2)); 11 | } 12 | 13 | int main(){ 14 | int i; 15 | for(i=0;i<12;i++){ 16 | 17 | printf("%d\t\n",fibonacci(i)); 18 | } 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /fibonacci.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main(int argc, char **argv) 5 | { 6 | int n,n1=0,n2=1,n3,i; 7 | cin >> n; 8 | 9 | for(i=0;i 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /framerec.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /gcd of 2 numbers: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | int n1, n2, i, gcd; 5 | 6 | printf("Enter two integers: "); 7 | scanf("%d %d", &n1, &n2); 8 | 9 | for(i=1; i <= n1 && i <= n2; ++i) 10 | { 11 | // Checks if i is factor of both integers 12 | if(n1%i==0 && n2%i==0) 13 | gcd = i; 14 | } 15 | 16 | printf("G.C.D of %d and %d is %d", n1, n2, gcd); 17 | 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /hactober.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/hactober.exe -------------------------------------------------------------------------------- /hangman/images/hangman0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/hangman/images/hangman0.png -------------------------------------------------------------------------------- /hangman/images/hangman1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/hangman/images/hangman1.png -------------------------------------------------------------------------------- /hangman/images/hangman2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/hangman/images/hangman2.png -------------------------------------------------------------------------------- /hangman/images/hangman3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/hangman/images/hangman3.png -------------------------------------------------------------------------------- /hangman/images/hangman4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/hangman/images/hangman4.png -------------------------------------------------------------------------------- /hangman/images/hangman5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/hangman/images/hangman5.png -------------------------------------------------------------------------------- /hangman/images/hangman6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/hangman/images/hangman6.png -------------------------------------------------------------------------------- /hello-world.kt: -------------------------------------------------------------------------------- 1 | fun main () { 2 | prinln("hello world") 3 | } 4 | -------------------------------------------------------------------------------- /hello-world.py: -------------------------------------------------------------------------------- 1 | #hello_world 2 | num = input("give me a positive number : ") 3 | for n in range (num): 4 | print "hello world",num,"times." 5 | -------------------------------------------------------------------------------- /helloworld.py: -------------------------------------------------------------------------------- 1 | print("Hello World!") 2 | -------------------------------------------------------------------------------- /hgdf: -------------------------------------------------------------------------------- 1 | #include 2 | void main() 3 | { 4 | int a,b,max; 5 | a=10; 6 | b=20; 7 | max=a>b?a:b; 8 | printf("maximum between these two is %d",max); 9 | 10 | 11 | } 12 | -------------------------------------------------------------------------------- /insertionSort.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | struct array{ 5 | int *A; 6 | int size; 7 | }; 8 | 9 | 10 | void InsertionSort(int B[],int size){ 11 | 12 | for(int i=1;i-1 && B[j]>x){ 16 | B[j+1]=B[j]; 17 | j--; 18 | } 19 | B[j+1]=x; 20 | } 21 | } 22 | 23 | int main(){ 24 | int B[]= {11,13,7,12,16,9,24,5,10,3,__INT32_MAX__}; 25 | 26 | InsertionSort(B,10); 27 | 28 | for (int i = 0; i < 10; i++) 29 | { 30 | printf("%d ",B[i]); 31 | } 32 | 33 | return 0; 34 | 35 | } -------------------------------------------------------------------------------- /intro.c: -------------------------------------------------------------------------------- 1 | printf("hi"); 2 | -------------------------------------------------------------------------------- /intro.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | prinft("Name - Jyoti Harode"); 6 | printf("Profession - SAP developer"); 7 | return 0; 8 | } 9 | -------------------------------------------------------------------------------- /join_two_strings.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | char *ft_strjoin(char const *s1, char const *s2) 7 | { 8 | int a; 9 | int b; 10 | size_t len; 11 | char *str; 12 | 13 | if (!s1 || !s2) 14 | return (NULL); 15 | len = strlen(s1) + strlen(s2); 16 | if (!(str = (char*)malloc(sizeof(char) * (len + 1)))) 17 | return (NULL); 18 | a = 0; 19 | while (s1[a] != '\0') 20 | { 21 | str[a] = s1[a]; 22 | a++; 23 | } 24 | b = 0; 25 | while (s2[b] != '\0') 26 | { 27 | str[a] = s2[b]; 28 | a++; 29 | b++; 30 | } 31 | str[a] = '\0'; 32 | return (str); 33 | } 34 | 35 | int main(int argc, char **argv) 36 | { 37 | if (argc != 3) 38 | { 39 | printf("You must introduce executable plus two strings between quotes and separate by a space (example: ./a.out \"Hello World\" \"from here\")\n"); 40 | exit (0); 41 | } 42 | printf("Lets join the two strings --> %s\n", ft_strjoin(argv[1], argv[2])); 43 | return (0); 44 | } 45 | -------------------------------------------------------------------------------- /largest_repeating_subsequence.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int longRepSubseq(string a){ 5 | int n = a.length(); 6 | 7 | //initialize DP table 8 | int dp[n+1][n+1]; 9 | memset(dp,0,sizeof(dp)); 10 | 11 | for (int i=1; i<=n; i++){ 12 | for (int j=1; j<=n; j++){ 13 | // Characters match but indexes are not same 14 | if (a[i-1] == a[j-1] && i != j) 15 | dp[i][j] = 1 + dp[i-1][j-1]; 16 | //characters do not match 17 | else 18 | dp[i][j] = max(dp[i][j-1], dp[i-1][j]); 19 | } 20 | } 21 | return dp[n][n]; 22 | } 23 | 24 | int main(){ 25 | string a = "aabbcdee"; 26 | cout << "Length of Largest Repeating Subsequence is "<< longRepSubseq(a); 27 | return 0; 28 | } -------------------------------------------------------------------------------- /linear_search.c: -------------------------------------------------------------------------------- 1 | 2 | //Write a program to implement Linear Search 3 | #include 4 | void main() 5 | { 6 | int a[50],i,n,elt,count;//declare the variables 7 | printf("\n\tLINEAR SEARCH");//for linear search 8 | printf("\n\t________________\n\n"); 9 | printf("\n\tEnter the limit:");//Enter the size of the array 10 | scanf("%d",&n); 11 | printf("\n\tEnter the elements:");//Enter the number of elements 12 | for(i=0;i y: 8 | smaller = y 9 | else: 10 | smaller = x 11 | for i in range(1, smaller+1): 12 | if((x % i == 0) and (y % i == 0)): 13 | hcf = i 14 | return hcf 15 | 16 | num1 = 54 17 | num2 = 24 18 | 19 | print("The H.C.F. is", compute_hcf(num1, num2)) 20 | -------------------------------------------------------------------------------- /matrix-add.c.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | //fill your code 5 | int m, n; 6 | scanf(“%d %d”,&m,&n); 7 | int i, j; 8 | int mat1[m][n], mat2[m][n], mat3[m][n]; 9 | for(i = 0; i < m; i++) 10 | { 11 | for(j = 0; j < n; j++) 12 | scanf(“%d”,&mat1[i][j]); 13 | } 14 | for(i = 0; i < n; i++) 15 | { 16 | for(j = 0; j < n; j++) 17 | scanf(“%d”,&mat2[i][j]); 18 | } 19 | 20 | for(i = 0; i < m; i++) 21 | { 22 | for(j = 0; j < n; j++) 23 | { 24 | mat3[i][j] = mat1[i][j] + mat2[i][j]; 25 | } 26 | } 27 | 28 | for(i = 0; i < m; i++) 29 | { 30 | for(j = 0; j < n; j++) 31 | printf(“%d “, mat3[i][j]); 32 | printf(“\n”); 33 | } 34 | 35 | return 0; 36 | } -------------------------------------------------------------------------------- /matrix_exponentation.cpp: -------------------------------------------------------------------------------- 1 | const int m = 2; 2 | typedef long long ll; 3 | #define forc(i, a, b) for(int i = (int)a; i < int(b); i++) 4 | class Matrix{ 5 | public: 6 | ll mat[m][m]; 7 | void init(){ 8 | mat[0][0] = k; mat[0][1] = 1; 9 | mat[1][0] = l; mat[1][1] = 0; 10 | } 11 | Matrix operator * (const Matrix &p){ 12 | Matrix ans; 13 | forc(i, 0, m) 14 | forc(j, 0, m) 15 | for(int k = ans.mat[i][j] = 0; k < m; k++) 16 | ans.mat[i][j] = (ans.mat[i][j] + (mat[i][k]%MOD) * (p.mat[k][j]%MOD)) % MOD; 17 | return ans; 18 | } 19 | }; 20 | 21 | Matrix fexp(Matrix a, ll b){ 22 | Matrix ans; 23 | forc(i, 0, m) 24 | forc(j, 0, m) 25 | ans.mat[i][j] = (i == j); 26 | while(b){ 27 | if(b&1) ans = ans*a; 28 | a = a*a; 29 | b >>= 1; 30 | } 31 | return ans; 32 | } 33 | -------------------------------------------------------------------------------- /max2darrayidx.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | using namespace std; 6 | 7 | //Function to return the element index number of the vector with the largest length in a 2d array. 8 | size_t max_size_index(vector> v) { 9 | decltype(v)::iterator m = max_element(v.begin(), v.end(), [](vector a, vector b) { 10 | return a.size() < b.size(); }); 11 | size_t index = std::distance(v.begin(), m); 12 | return index; 13 | 14 | } 15 | 16 | 17 | 18 | 19 | 20 | int main() { 21 | vector> array2d = { {1,2,3}, {4,5,6}, {7,8,9,10} }; 22 | 23 | auto i = max_size_index(array2d); 24 | //return 2 25 | cout << i << endl; 26 | return 0; 27 | } -------------------------------------------------------------------------------- /media/abstract_17.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/media/abstract_17.jpg -------------------------------------------------------------------------------- /media/bubble.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/media/bubble.png -------------------------------------------------------------------------------- /media/wings 2 icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/media/wings 2 icon.ico -------------------------------------------------------------------------------- /minimum.c: -------------------------------------------------------------------------------- 1 | __attribute__((section(".text#"))) 2 | int main=195; 3 | -------------------------------------------------------------------------------- /month&days.c: -------------------------------------------------------------------------------- 1 | //Program to convert days into month and days 2 | 3 | #include 4 | int main() 5 | { 6 | int month, day; 7 | printf("enter the number of days:\t"); 8 | scanf("%d",&day); 9 | month = day / 30; 10 | day = day %30; 11 | printf("month: %d \ndays: %d", month, day); 12 | } 13 | -------------------------------------------------------------------------------- /multiplication_matrix.c: -------------------------------------------------------------------------------- 1 | //For multiplication of two matrices. 2 | #include 3 | #include 4 | int main() 5 | { 6 | int a[10][10],b[10][10],c[10][10], m,n,i,j,sum=0; 7 | 8 | printf("enter values for m and n:\t"); 9 | scanf("%d\t%d",&m,&n); 10 | 11 | printf("Enter first matrix elements\n"); 12 | for(i=0;i 2 | int main() 3 | { 4 | int n; 5 | printf("Enter the number of process\n"); 6 | scanf("%d",&n); 7 | int a[n][4],c=0; 8 | for(int i=0;i 2 | using namespace std; 3 | 4 | // A recursive function to find nth catalan number 5 | unsigned long int catalan(unsigned int n) 6 | { 7 | // Base case 8 | if (n <= 1) 9 | return 1; 10 | 11 | // catalan(n) is sum of 12 | // catalan(i)*catalan(n-i-1) 13 | unsigned long int res = 0; 14 | for (int i = 0; i < n; i++) 15 | res += catalan(i) 16 | * catalan(n - i - 1); 17 | 18 | return res; 19 | } 20 | 21 | // Driver code 22 | int main() 23 | { 24 | for (int i = 0; i < 10; i++) 25 | cout << catalan(i) << " "; 26 | return 0; 27 | } 28 | -------------------------------------------------------------------------------- /number guesser game.py: -------------------------------------------------------------------------------- 1 | i=0 2 | print("Welcome to my game, here you have to guess a given number in maximum of 9 tries.\n") 3 | while(i<10): 4 | a=int(input("Enter your guess here: ")) 5 | i=i+1 6 | if a==21: 7 | print("Congratulations you've won the game.") 8 | print("No. of guesses used: ",i) 9 | break 10 | 11 | elif a>21: 12 | print("Your entered number is greater than the number. Try again") 13 | print("No. of guesses used: ",i) 14 | continue 15 | elif a<21: 16 | print("Your entered number is smaller than the number. Try again") 17 | print("No. of guesses used: ",i) 18 | continue 19 | 20 | if i==10: 21 | print("GAME OVER the number was 21") 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /number_of_set_bits.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | //Count Set Bits 5 | unsigned int countSetBits(unsigned int n) { 6 | // c is the number of count of set bits 7 | unsigned int c = 0; 8 | while (n) { 9 | n = n & (n-1); 10 | c++; 11 | } 12 | return c; 13 | } 14 | 15 | int main() { 16 | //n is the desired input 17 | int n = 17; 18 | 19 | //Print the number of set bits 20 | cout <<"Number of set bits are " << countSetBits(n); 21 | return 0; 22 | } -------------------------------------------------------------------------------- /palindrome-kotlin.kt: -------------------------------------------------------------------------------- 1 | fun palindrome(n:Int):Int{ 2 | 3 | if(n==0) 4 | return 0 5 | if(n==1||n==2) 6 | return 1 7 | else 8 | return palindrome(n-1)+palindrome(n-2) 9 | } 10 | 11 | fun main(){ 12 | val range=10 13 | repeat(range){ 14 | index->println(palindrome(index)) 15 | } 16 | } -------------------------------------------------------------------------------- /palindrome.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | void main() 4 | { 5 | int n,x,r=0,t; 6 | printf("Enter the number you want to check" ); 7 | scanf("%d",&n); 8 | t=n; 9 | while(n!=0) 10 | { 11 | x=n%10; 12 | r=r*10+x; 13 | n/=10; 14 | } 15 | if (t==r) 16 | { 17 | printf("Palindrome"); 18 | } 19 | else 20 | { 21 | printf("Not Palindrome"); 22 | } 23 | 24 | getch(); 25 | } 26 | -------------------------------------------------------------------------------- /ping pong/ball.py: -------------------------------------------------------------------------------- 1 | import turtle as t 2 | 3 | class Ball(t.Turtle): 4 | def __init__(self): 5 | super().__init__() 6 | self.penup() 7 | self.shape("circle") 8 | self.color("white") 9 | self.x = 10 10 | self.y = 10 11 | self.move_speed = 0.1 12 | 13 | 14 | 15 | 16 | 17 | def go(self): 18 | new_x = self.xcor() +self.x 19 | new_y = self.ycor() + self.y 20 | 21 | self.goto(new_x,new_y) 22 | 23 | 24 | def bounce_y(self): 25 | self.y *= -1 26 | self.move_speed *=0.9 27 | 28 | def bounce_x(self): 29 | self.x *= -1 30 | self.move_speed *= 0.9 31 | 32 | def skrrt(self): 33 | self.goto(0,0) 34 | self.move_speed = 0.1 35 | self.y *= -1 36 | self.x *= -1 37 | 38 | -------------------------------------------------------------------------------- /ping pong/paddle.py: -------------------------------------------------------------------------------- 1 | TOTAL_PADDLE =2 2 | import turtle as t 3 | 4 | class Paddle(t.Turtle): 5 | def __init__(self, postion): 6 | super().__init__() 7 | self.new_pad = [] 8 | self.penup() 9 | self.shape("square") 10 | self.shapesize(stretch_len=5, stretch_wid=1) 11 | self.color("white") 12 | self.setheading(90) 13 | self.setpos(postion) 14 | 15 | 16 | 17 | 18 | 19 | 20 | def goUp(self): 21 | 22 | new_y = self.ycor() + 20 23 | self.goto(self.xcor(), new_y) 24 | 25 | def goDown(self): 26 | 27 | new_y = self.ycor() - 20 28 | self.goto(self.xcor(), new_y) -------------------------------------------------------------------------------- /ping pong/scoreboard.py: -------------------------------------------------------------------------------- 1 | import turtle as t 2 | 3 | class ScoreBoard(t.Turtle): 4 | def __init__(self): 5 | super().__init__() 6 | self.penup() 7 | self.color("white") 8 | self.hideturtle() 9 | self.l_score = 0 10 | self.r_score = 0 11 | self.update_score() 12 | 13 | def update_score(self): 14 | self.clear() 15 | self.goto(-100,200) 16 | self.write(self.l_score,align="center",font=("Courier",80,"normal")) 17 | self.goto(100,200) 18 | self.write(self.r_score,align="center",font=("Courier",80,"normal")) 19 | 20 | def l_ascore(self): 21 | self.l_score += 1 22 | 23 | def r_ascore(self): 24 | self.r_score += 1 -------------------------------------------------------------------------------- /pointer.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | main() 4 | { 5 | int *px, y; 6 | px = &y; 7 | 8 | printf("\n Enter Your Value = "); 9 | scanf("%d", &y); 10 | printf(" Your Value %d \n", *px); 11 | } 12 | -------------------------------------------------------------------------------- /primeNum.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | 4 | { 5 | 6 | int n, i, flag = 0; 7 | 8 | printf("Enter a positive integer: "); 9 | 10 | scanf("%d", &n); 11 | 12 | for (i = 2; i <= n / 2; ++i) 13 | 14 | { 15 | 16 | if (n % i == 0) 17 | 18 | { 19 | 20 | flag = 1; 21 | 22 | break; 23 | 24 | } 25 | 26 | } 27 | 28 | if (n == 1) { 29 | 30 | printf("1 is neither prime nor composite."); 31 | 32 | } 33 | 34 | else { 35 | 36 | if (flag == 0) 37 | 38 | printf("%d is a prime number.", n); 39 | 40 | else 41 | 42 | printf("%d is not a prime number.", n); 43 | 44 | } 45 | 46 | return 0; 47 | 48 | } 49 | -------------------------------------------------------------------------------- /print.py: -------------------------------------------------------------------------------- 1 | print("Hello World") 2 | -------------------------------------------------------------------------------- /quiz.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | class Question: 4 | def __init__(self, prompt, answer): 5 | self.prompt = prompt 6 | self.answer = answer 7 | 8 | question_prompts = [ 9 | "What color are apples?\n(a) Red/Green\n(b)Orange", 10 | "What color are bananas?\n(a) Red/Green\n(b)Yellow", 11 | ] 12 | 13 | questions = [ 14 | Question(question_prompts[0], "a"), 15 | Question(question_prompts[1], "b"), 16 | ] 17 | 18 | def run_quiz(questions): 19 | score = 0 20 | for question in questions: 21 | answer = input(question.prompt) 22 | if answer == question.answer: 23 | score += 1 24 | print("you got", score, "out of", len(questions)) 25 | 26 | run_quiz(questions) 27 | -------------------------------------------------------------------------------- /reciprocal.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/reciprocal.exe -------------------------------------------------------------------------------- /reverse-number.c.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | int n, reverse=0, rem; 5 | printf("Enter a number: "); 6 | scanf("%d", &n); 7 | while(n!=0) 8 | { 9 | rem=n%10; 10 | reverse=reverse*10+rem; 11 | n/=10; 12 | } 13 | printf("Reversed Number: %d",reverse); 14 | return 0; 15 | } -------------------------------------------------------------------------------- /reverseList.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | struct Node 5 | { 6 | int data; 7 | struct Node *next; 8 | Node(int x) 9 | { 10 | data = x; 11 | next = NULL; 12 | } 13 | }; 14 | //typedef struct node Node; 15 | 16 | void display(Node *head) 17 | { 18 | Node *ptr = head; 19 | while(ptr != NULL) 20 | { 21 | cout << ptr->data << endl; 22 | } 23 | } 24 | Node *reverseList(Node *head) 25 | { 26 | Node *prev = NULL; 27 | Node *curr = head; 28 | Node *forw = NULL; 29 | 30 | while(curr != NULL) 31 | { 32 | forw = curr->next; 33 | curr->next = prev; 34 | prev = curr; 35 | curr = forw; 36 | } 37 | return prev; 38 | } 39 | int main() 40 | { 41 | Node *head = new Node(1); 42 | head->next = new Node(2); 43 | head->next = new Node(3); 44 | head->next = new Node(4); 45 | head->next = new Node(5); 46 | 47 | display(head); 48 | head = reverseList(head); 49 | 50 | display(head); 51 | 52 | return 0; 53 | } 54 | -------------------------------------------------------------------------------- /reverseNumber.py: -------------------------------------------------------------------------------- 1 | try: 2 | n=int(input('Enter number to reverse :')) 3 | rev=0 4 | while(n!=0): 5 | r=int(n%10) 6 | rev=rev*10+r 7 | n=int(n/10) 8 | print('reversed number of given number =', rev) 9 | 10 | except ValueError: 11 | print('Given input is not a accepted value') 12 | -------------------------------------------------------------------------------- /rotate_bits.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int INT_BITS = 32; 5 | 6 | //Function to left rotate n by d bits 7 | int leftRotate(int n, unsigned int d) { 8 | return (n << d)|(n >> (INT_BITS - d)); 9 | } 10 | 11 | //Function to right rotate n by d bits 12 | int rightRotate(int n, unsigned int d) { 13 | return (n >> d)|(n << (INT_BITS - d)); 14 | } 15 | 16 | int main() { 17 | // n is the desired nuber to rotate 18 | int n = 4; 19 | 20 | // d is the number of digits by which we want to rotate 21 | int d = 2; 22 | 23 | // left rotation of n by d digits 24 | cout << "Left Rotation of " << n << " by " << d << " is " << leftRotate(n, d)<<"\n"; 25 | 26 | //right rotation of n by d digits 27 | cout << "Right Rotation of " << n <<" by " << d << " is "<< rightRotate(n, d); 28 | 29 | return 0; 30 | } -------------------------------------------------------------------------------- /search_linear.js: -------------------------------------------------------------------------------- 1 | // Linear search algorithm 2 | 3 | function linearSearch(arr, num) { 4 | for (let i = 0; i < arr.length; i++) { 5 | if (arr[i] === num) return i; 6 | } 7 | return -1 8 | } 9 | linearSearch([10, 15, 20, 25, 30], 15) 10 | -------------------------------------------------------------------------------- /second_large.c: -------------------------------------------------------------------------------- 1 | //50) To find out second largest element of an unsorted array. 2 | #include 3 | #include 4 | int main() 5 | { 6 | int a[5],i,j,max,max1; 7 | printf("Enter the array elements:"); 8 | for(i=0;i<5;i++) 9 | { 10 | scanf("%d",&a[i]); 11 | } 12 | max=a[0]; 13 | for(i=0;i<5;i++) 14 | { 15 | if(maxmax1 && a[j] arr[j]: 15 | # swap 16 | arr[i], arr[j] = arr[j], arr[i] 17 | swaps = swaps + 1 18 | 19 | j = j + 1 20 | i = i + 1 21 | print(f"{arr}") 22 | print(f"Steps: {i} \t Swaps: {swaps}") 23 | return arr 24 | 25 | a = [2,6,9,4,8,1,5,7] 26 | sorted_arr = selectionSort(a) 27 | print(f"Sorted Array is: {sorted_arr}") -------------------------------------------------------------------------------- /sizeof the tree.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | 5 | class node 6 | { 7 | public: 8 | int data; 9 | node* lchild; 10 | node* rchild; 11 | }; 12 | 13 | 14 | node* newNode(int data) 15 | { 16 | node* Node = new node(); 17 | Node->data = data; 18 | Node->lchild = NULL; 19 | Node->rchild = NULL; 20 | 21 | return(Node); 22 | } 23 | 24 | /* function to find the number of nodes in a tree. */ 25 | int sizeoftree(node* node) 26 | { 27 | if (node == NULL) 28 | return 0; 29 | else 30 | return(sizeoftree(node->lchild) + 1 + sizeoftree(node->rchild)); 31 | } 32 | 33 | 34 | int main() 35 | { 36 | node *root = newNode(1); 37 | root->lchild = newNode(3); 38 | root->rchild = newNode(8); 39 | root->lchild->lchild = newNode(10); 40 | root->lchild->rchild = newNode(20); 41 | 42 | cout << "Size of the tree is " << sizeoftree(root); 43 | return 0; 44 | } 45 | -------------------------------------------------------------------------------- /speedtest.py: -------------------------------------------------------------------------------- 1 | import speedtest 2 | speed = speedtest.Speedtest() 3 | download_speed = speed.download() 4 | upload_speed = speed.upload() 5 | print(f'The download speed is {download_speed}') 6 | print(f'The uplaod speed is {upload_speed}') 7 | -------------------------------------------------------------------------------- /starpyramid.c: -------------------------------------------------------------------------------- 1 | // C Program to draw Pyramid pattern 2 | 3 | #include 4 | 5 | int main() { 6 | int row; 7 | printf("enter row"); 8 | scanf("%d", &row); 9 | int temp = row; 10 | 11 | for (; row > 0; row--) 12 | { 13 | for (int _ = 0; _ < row; _++) 14 | { 15 | printf(" "); 16 | } 17 | for (int star = temp - row; star > 0; star--) 18 | { 19 | printf("* "); 20 | } 21 | printf("\n"); 22 | } 23 | } -------------------------------------------------------------------------------- /string_length.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | size_t ft_strlen(const char *s) 5 | { 6 | size_t a; 7 | 8 | a = 0; 9 | while (s[a] != '\0') 10 | a++; 11 | return (a); 12 | } 13 | 14 | int main(int argc, char **argv) 15 | { 16 | if (argc != 2) 17 | { 18 | printf("You must introduce executable plus the string between quotes (example: ./a.out \"Hello World\")\n"); 19 | exit (0); 20 | } 21 | printf("The length of your string is --> %zu\n", ft_strlen(argv[1])); 22 | return (0); 23 | } -------------------------------------------------------------------------------- /string_reverse.cpp: -------------------------------------------------------------------------------- 1 | //Reversing the string words at their own place. 2 | #include 3 | #include 4 | #include 5 | #include 6 | void main() 7 | { clrscr(); 8 | char str[5000],word[20],s; 9 | int i,k=0; 10 | cout<<"\n enter any string\n"; //Taking input in a character array str. 11 | gets(str); 12 | strcat(str," "); 13 | for(i=0;str[i]!='\0';i++) 14 | { 15 | if(str[i]!=' ') 16 | { 17 | word[k++]=str[i]; //checking for spaces and reversing each word at it's own place in sentence. 18 | } 19 | else 20 | { 21 | while(k>0) 22 | cout< 2 | int main() { 3 | int n, i, sum = 0; 4 | printf("Enter your positive integer: "); 5 | scanf("%d", &n); 6 | 7 | int sum_count = (n*(n+1))/2; 8 | printf("Sum1 = %d", sum_count); 9 | 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /sum-rc-matrix.c: -------------------------------------------------------------------------------- 1 | //WAP to find sum of rows and columns of a matrix 2 | 3 | #include 4 | 5 | void main(){ 6 | int m,n; 7 | printf("Enter the number of rows and columns of the matrix: \n"); 8 | scanf("%d %d",&m,&n); 9 | int A[m][n]; 10 | for(int i=0;i 2 | void main() 3 | { 4 | long long int a, b, c, d, e, f, g, h, i; 5 | printf("enter your 7 digit no="); 6 | scanf("%lld", &a); 7 | b = a % 10; 8 | c = a / 10; 9 | d = c % 10; 10 | e = c / 10; 11 | f = e % 10; 12 | g = e / 10; 13 | h = g % 10; 14 | i = h + f + d + b; 15 | printf("\n sum of last four digits entered by you" 16 | "%lld", 17 | i); 18 | } -------------------------------------------------------------------------------- /sum_of_natural_numbers_using_recursion.c: -------------------------------------------------------------------------------- 1 | #include 2 | int addNumbers(int n); 3 | int main() { 4 | int num; 5 | printf("Enter a positive integer: "); 6 | scanf("%d", &num); 7 | printf("Sum = %d", addNumbers(num)); 8 | return 0; 9 | } 10 | 11 | int addNumbers(int n) { 12 | if (n != 0) 13 | return n + addNumbers(n - 1); 14 | else 15 | return n; 16 | } 17 | -------------------------------------------------------------------------------- /swaptwonumbers: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | int a=10, b=20; 5 | printf("Before swap a=%d b=%d",a,b); 6 | a=a+b;//a=30 (10+20) 7 | b=a-b;//b=10 (30-20) 8 | a=a-b;//a=20 (30-10) 9 | printf("\nAfter swap a=%d b=%d",a,b); 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /threeboxes.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | int test; 6 | cin>>test; 7 | while(test--) 8 | { 9 | int a,b,c,d; 10 | cin>>a>>b>>c>>d; 11 | if(a+b+c <=d) 12 | { 13 | cout<<1< 2 | void towerOfHanoi(int d,char T1,char T2,char T3) 3 | { 4 | if(d==1){ 5 | printf("\nmove disk from %c to %c ",T1,T2); 6 | return; 7 | } 8 | towerOfHanoi(d-1,T1,T3,T2); 9 | printf("\nmove disk from %c to %c",T1,T2); 10 | towerOfHanoi(d-1,T3,T2,T1); 11 | 12 | } 13 | 14 | int main(){ 15 | int rings; 16 | printf("enter the number of rings : "); 17 | scanf("%d",&rings); 18 | towerOfHanoi(rings,'A','C','B'); 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /trace of matrix.c: -------------------------------------------------------------------------------- 1 | / Trace of the matrix 2 | // Trace of the matrix is called sum of the elements in a principle diagonal of the square matrix. 3 | 4 | #include 5 | 6 | int main(){ 7 | int i,j,n; 8 | printf("Enter the size of square matrix: "); 9 | scanf("%d",&n); 10 | int arr[n][n],sum=0; 11 | 12 | // input 13 | for(i=0;i 3 | 4 | void main() { 5 | int i,j,m,n; 6 | printf("Enter the number of rows and columns od the matrix: \n"); 7 | scanf("%d,%d",&m,&n); 8 | int A[m][n], B[n][m]; 9 | printf("Enter the elements of the matrix: \n"); 10 | for(i=0;i 2 | using namespace std; 3 | 4 | 5 | int main(){ 6 | 7 | int m,n; 8 | cin >> m >> n; 9 | int arr[m][n]; 10 | int transp[n][m]; 11 | 12 | for ( int i=0 ; i> arr[i][j] ; 18 | 19 | } 20 | 21 | 22 | 23 | } 24 | 25 | for (int i=0; i< m ;i++){ 26 | for (int j=0 ;j< n;j++){ 27 | transp[j][i]=arr[i][j]; 28 | } 29 | } 30 | 31 | 32 | for (int i=0 ; i 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | java Script for footer:- 14 | 15 | 16 | -------------------------------------------------------------------------------- /travel seeker/travel seeker/components/navbar.text: -------------------------------------------------------------------------------- 1 | css link for navbar:- 2 | 8 | 9 | 10 | js link for navbar:- 11 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /travel seeker/travel seeker/forfootermahima.js: -------------------------------------------------------------------------------- 1 | import footer from "./components/footer.js"; 2 | let mainFooter = document.getElementById("imported-footer"); 3 | mainFooter.innerHTML = footer(); -------------------------------------------------------------------------------- /travel seeker/travel seeker/images/Screenshot 2023-04-12 151545.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/travel seeker/travel seeker/images/Screenshot 2023-04-12 151545.png -------------------------------------------------------------------------------- /travel seeker/travel seeker/images/Screenshot 2023-04-12 151745.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/travel seeker/travel seeker/images/Screenshot 2023-04-12 151745.png -------------------------------------------------------------------------------- /travel seeker/travel seeker/images/image1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHEERAJHARODE/Hacktoberfest2024-Open-source-/1c8699098646d95e9dfab257f41589b41c3fc036/travel seeker/travel seeker/images/image1.png -------------------------------------------------------------------------------- /value_of_pi.py: -------------------------------------------------------------------------------- 1 | # The formula to calculate the value of pi is X = 4 - 4/3 + 4/5 - 4/7 + 4/9 ..... 2 | # This code is an implementation of the same formula 3 | 4 | # Initialize denominator as integer 5 | k = 1 6 | 7 | # Initialize sum as integer 8 | s = 0 9 | 10 | for i in range(10000): 11 | # Loop ends at a very big number as pi is never ending 12 | 13 | if i % 2 == 0: 14 | s + = 4/k 15 | else: 16 | 17 | # odd index elements are negative 18 | s -= 4/k 19 | 20 | # denominator is odd 21 | k += 2 22 | 23 | print(s) 24 | -------------------------------------------------------------------------------- /whichmix.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main(){ 4 | int t; 5 | cin>>t; 6 | while(t--){ 7 | int a,b; 8 | cin>>a>>b; 9 | if(a>0 && b>0){ 10 | cout<<"Solution"; 11 | } 12 | else if(a==0 && b>0){ 13 | cout<<"Liquid"; 14 | } 15 | else if(b==0 && a>0){ 16 | cout<<"Solid"; 17 | } 18 | cout<