Lädt...

🔧 Leetcode - 167. Two Sum II - Input Array Is Sorted


Nachrichtenbereich: 🔧 Programmierung
🔗 Quelle: dev.to

Javascript Code

/**
 * @param {number[]} numbers
 * @param {number} target
 * @return {number[]}
 */
var twoSum = function(numbers, target) {

    let p1 = 0;
    let p2 = numbers.length - 1;

    while ( p1 < p2){
        if(numbers[p1] + numbers[p2] == target){
            break;
        }
        if(numbers[p1] + numbers[p2] > target){
            p2--;
        }else{
            p1++
        }
    }
    return [p1+1,p2+1]
};
...

🔧 Check if Array can be sorted by swapping adjacent elements having odd sum


📈 42.86 Punkte
🔧 Programmierung

🔧 Solving a Leetcode problem daily — Day 11 | Find Minimum in Rotated Sorted Array


📈 40.57 Punkte
🔧 Programmierung

🔧 Solving a Leetcode problem daily — Day 10 | Find first and last position in sorted array


📈 40.57 Punkte
🔧 Programmierung

🔧 Leetcode - 80. Remove Duplicates from Sorted Array II


📈 40.57 Punkte
🔧 Programmierung

🔧 Leetcode - 26. Remove Duplicates from Sorted Array


📈 40.57 Punkte
🔧 Programmierung

🔧 🧩 LeetCode Challenge: Merge Sorted Array | Top Interview Questions [Java Solution]


📈 40.57 Punkte
🔧 Programmierung

🔧 🧩 LeetCode Challenge: Merge Sorted Array | Top Interview Questions [Java Solution]


📈 40.57 Punkte
🔧 Programmierung

🔧 LeetCode Challenge: 80. Remove Duplicates from Sorted Array II - JavaScript Solution 🚀


📈 40.57 Punkte
🔧 Programmierung

🔧 LeetCode Challenge: 26. Remove Duplicates from Sorted Array - JavaScript Solution 🚀


📈 40.57 Punkte
🔧 Programmierung

🔧 LeetCode Challenge: 88. Merge Sorted Array - JavaScript Solution


📈 40.57 Punkte
🔧 Programmierung

🔧 💡Solving LeetCode 34: Find First and Last Position of Element in a Sorted Array


📈 40.57 Punkte
🔧 Programmierung

🔧 Leetcode Day 7: Remove Duplicated from Sorted Array Explained


📈 40.57 Punkte
🔧 Programmierung

🔧 Leetcode diary: Remove Duplicates from Sorted Array II


📈 40.57 Punkte
🔧 Programmierung

🔧 Find First and Last Position of Element in Sorted Array | LeetCode | Java


📈 40.57 Punkte
🔧 Programmierung

🔧 Bubble Sort: Given an Array of Unsorted Items, Return A Sorted Array


📈 37.9 Punkte
🔧 Programmierung

🔧 Leetcode - 21. Merge Two Sorted Lists


📈 36.95 Punkte
🔧 Programmierung

🔧 LeetCode in Swift - 21. Merge Two Sorted Lists


📈 36.95 Punkte
🔧 Programmierung

🔧 Median of Two Sorted Arrays – LeetCode Hard Solutions


📈 36.95 Punkte
🔧 Programmierung

🔧 Leetcode Day 6: Merge Two Sorted Lists Explained


📈 36.95 Punkte
🔧 Programmierung

🔧 How to merge K sorted linked list and return a sorted linked list in the end


📈 36.78 Punkte
🔧 Programmierung

🔧 Min sum of set of positive integers so that sum of no two elements is K


📈 35.56 Punkte
🔧 Programmierung

🔧 Array- Q2 Median of Two Sorted Arrays


📈 34.28 Punkte
🔧 Programmierung

🔧 JS Sum of an Array – How to Add the Numbers in a JavaScript Array


📈 34.22 Punkte
🔧 Programmierung

🔧 Print the sum of array after doing k queries on the array


📈 34.22 Punkte
🔧 Programmierung

🔧 Maximize Array sum by adding multiple of another Array element in given ranges


📈 34.22 Punkte
🔧 Programmierung

🔧 371 SUM OF TWO INTEGERS - leetcode - Python


📈 33.27 Punkte
🔧 Programmierung

🔧 LeetCode Meditations: Sum of Two Integers


📈 33.27 Punkte
🔧 Programmierung

🔧 Two Sum Problem’ on LeetCode


📈 33.27 Punkte
🔧 Programmierung

🔧 LeetCode #1. Two Sum


📈 33.27 Punkte
🔧 Programmierung

🔧 Leetcode Day 1: Two Sum


📈 33.27 Punkte
🔧 Programmierung

🔧 LeetCode Meditations: Two Sum


📈 33.27 Punkte
🔧 Programmierung

🔧 How to Build a Visualization for Leetcode's Two Sum Problem – HTML, CSS, &amp; JavaScript Project


📈 33.27 Punkte
🔧 Programmierung

🔧 1508. Range Sum of Sorted Subarray Sums


📈 33.1 Punkte
🔧 Programmierung

🔧 LeetCode Meditations: Merge K Sorted Lists


📈 30.81 Punkte
🔧 Programmierung

matomo