leetcode
Leetcode - Two Sums(1)
· ☕ 2 min read · ✍️ devoalda
Introduction 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. Input and Output 1 2 3 Input: nums = [2,7,11,15], target = 9 Output: [0,1] Explanation: Because nums[0] + nums[1] == 9, we return [0, 1].

Leetcode - Concatenation of array(1929)
· ☕ 2 min read · ✍️ devoalda
Introduction Given an integer array nums of length n, you want to create an array ans of length 2n where ans[i] == nums[i] and ans[i + n] == nums[i] for 0 <= i < n (0-indexed). Specifically, ans is the concatenation of two nums arrays. Return the array ans. Example 1 2 3 4 5 Input: nums = [1,2,1] Output: [1,2,1,1,2,1] Explanation: The array ans is formed as follows: - ans = [nums[0],nums[1],nums[2],nums[0],nums[1],nums[2]] - ans = [1,2,1,1,2,1] Process This was a pretty simple one other that figuring out how to use malloc again.

Leetcode - Ugly Number(263)
· ☕ 2 min read · ✍️ devoalda
Introduction Write a program to check whether a given number is an ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. Given an integer n, return true if n is an ugly number. Input and Output Format 1 2 3 Input: n = 6 Output: true Explanation: 6 = 2 × 3 Process This was my thought process while attempting this challenge.