Arrays in Memory

Arrays are a data structure used to store a collection of elements of the same type. They are stored in memory continuously. This means that all the elements of the array can be found sequentially in memory. Arrays in RAM Array elements are stored sequentially in memory. The memory address of the first element of the array is used to access the entire array. The size of the data between each element in the array is determined by the size of the data type of the elements....

July 1, 2024 · 2 min · 280 words · Xavier Loera Flores

Two Sum

Problem https://leetcode.com/problems/two-sum/ 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. Examples Example 1: Input: nums = [2,7,11,15], target = 9 Output: [0,1] Explanation: Because nums[0] + nums[1] == 9, we return [0, 1]....

June 8, 2024 · 3 min · 532 words · Xavier Loera Flores