leetcode solution of problem 1409

Queries on a Permutation With Key Given the array queries of positive integers between 1 and m, you have to process all queries[i] (from i=0 to i=queries.length-1) according to the following rules: In the beginning, you have the permutation P=[1,2,3,…,m]. For the current i, find the position of queries[i] in the permutation P (indexing from…

leetcode 1929 solution in java

Concatenation of Array 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. The problem is taken…