• 8 Patterns Review For Successful Coding Interview

    8 Patterns Review For Successful Coding Interview This is nothing but quick 5 min revision before going to interview. Visit https: https://codeandalgo.com for more such contents

  • Median of Two Sorted Arrays

    LeetCode # 4 Problem statement Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Example Example 1: Example 2: JAVA CODE Median of Two Sorted Arrays BRUTE FORCE APPROACH LOGIC Better Approach LOGIC Optimal Solution Logic Complexity Visit https: https://codeandalgo.com for more such contents.

  • Maximum Product of Two Elements in an Array

    LeetCode # 1464 LOGIC Time Taken = 37 mins JAVA CODE Maximum Product of Two Elements in an Array Visit https: https://codeandalgo.com for more such contents

  • Add Two Numbers in Linked List format

    LeetCode Problem #2 DO NOT LOSE CONFIDENCE Simple Example Alway try to take simple example SUM of number1 + number 2 = 4321 + 98 = 4419 But EXPECTED answer is NOT 4419 but it is reverse of 4419 i.e. [9, 1, 4, 4] TRICK JAVA CODE Add Two Numbers in Linked List format Visit…

  • Add to Array-Form of Integer

    LeetCode Problem #989 Problem Statement The array-form of an integer num is an array representing its digits in left to right order. Given num, the array-form of an integer, and an integer k, return the array-form of the integer num + k. Example 1: Input: num = [1,2,0,0], k = 34Output: [1,2,3,4]Explanation: 1200 + 34 = 1234 LOGIC We have 2 numbers lets say number_1 and number_2….

  • Two Sum

    LeetCode#1 Problem Statement Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each input would have exactly one solution, and you may not use the same element twice. You can return the answer in any order. Golang code for Two sum JAVA CODE TWO SUM Version-1…

  • Water Bottles

    1518. Water Bottles Problem Statement There are numBottles water bottles that are initially full of water. You can exchange numExchange empty water bottles from the market with one full water bottle. The operation of drinking a full water bottle turns it into an empty bottle. Given the two integers numBottles and numExchange, return the maximum number of water bottles you can drink. JAVA CODE Water…