Team Ai
Datasetpublic

FPEvalRepoPublic/LeetCodeMetaData

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes399downloads
keep-multiplying-found-values-by-two.json29 linesDownload Raw Back to root
1{2  "id": 2274,3  "name": "keep-multiplying-found-values-by-two",4  "difficulty": "Easy",5  "link": "https://leetcode.com/problems/keep-multiplying-found-values-by-two/",6  "date": "2022-01-23",7  "task_description": "You are given an array of integers `nums`. You are also given an integer `original` which is the first number that needs to be searched for in `nums`. You then do the following steps: If `original` is found in `nums`, **multiply** it by two (i.e., set `original = 2 * original`). Otherwise, **stop** the process. **Repeat** this process with the new number as long as you keep finding the number. Return _the **final** value of _`original`. **Example 1:** ``` **Input:** nums = [5,3,6,1,12], original = 3 **Output:** 24 **Explanation:** - 3 is found in nums. 3 is multiplied by 2 to obtain 6. - 6 is found in nums. 6 is multiplied by 2 to obtain 12. - 12 is found in nums. 12 is multiplied by 2 to obtain 24. - 24 is not found in nums. Thus, 24 is returned. ``` **Example 2:** ``` **Input:** nums = [2,7,9], original = 4 **Output:** 4 **Explanation:** - 4 is not found in nums. Thus, 4 is returned. ``` **Constraints:** `1 <= nums.length <= 1000` `1 <= nums[i], original <= 1000`",8  "test_case": [9    {10      "label": "Example 1",11      "input": "nums = [5,3,6,1,12], original = 3",12      "output": "24 "13    },14    {15      "label": "Example 2",16      "input": "nums = [2,7,9], original = 4",17      "output": "4 "18    }19  ],20  "constraints": [21    "1 <= nums.length <= 1000",22    "1 <= nums[i], original <= 1000"23  ],24  "python_template": "class Solution(object):\n    def findFinalValue(self, nums, original):\n        \"\"\"\n        :type nums: List[int]\n        :type original: int\n        :rtype: int\n        \"\"\"\n        ",25  "java_template": "class Solution {\n    public int findFinalValue(int[] nums, int original) {\n        \n    }\n}",26  "metadata": {27    "func_name": "findFinalValue"28  }29}