Skip to main content

Questions tagged [array]

An array is an ordered data structure consisting of a collection of elements (values or variables), each identified by one (single dimensional array, or vector) or multiple indexes.

Filter by
Sorted by
Tagged with
2 votes
2 answers
1k views

Find shape of n-dim array that'd be formed from nested list of lists with variable lengths if we were to pad the lists to same length at each nest level. E.g. ...
OverLordGoldDragon's user avatar
5 votes
3 answers
1k views

To learn C, I'm doing the traditional FizzBuzz challenge with extra restrictions: The start and end of sequence is provided by the user Instead of directly printing the results, the results must be ...
NPN328's user avatar
  • 791
1 vote
1 answer
439 views

In question "Dictionary based non-local mean implementation in Matlab", the Manhattan distance between two three-dimensional structures can be calculated by ...
JimmyHu's user avatar
  • 7,575
0 votes
2 answers
533 views

This is LeetCode question 118 Pascal's triangle. Given an integer numRows, return the first numRows of Pascal's triangle. There is an example. Input: numRows = 5 Output: [[1],[1,1],[1,2,1],[1,3,3,1]...
xtryingx's user avatar
4 votes
2 answers
3k views

I primarily work with C#, and when working with an array of arrays, I can sum the length of the sub arrays using Linq: ...
Taco's user avatar
  • 929
1 vote
2 answers
3k views

I do have my code running but again I'm wondering if there is a nicer solution since mine seems to be clumsy and I'm wondering if there is a better way like chaining (but I can't work out how to do ...
BreadcrumbPie's user avatar
0 votes
1 answer
200 views

I have a working solution for the problem below. I have the feeling that it could be improved using memoization, but I cannot see how to do it. The problem: You are given an array arr of N integers. ...
myTest532 myTest532's user avatar
3 votes
1 answer
180 views

Given a dictionary including multiple X-Y pairs where X, Y are both three dimensional structure. dictionaryBasedNonlocalMean function returns a ...
JimmyHu's user avatar
  • 7,575
2 votes
1 answer
806 views

The TEXTJOIN function has a really nice interface: =TEXTJOIN(delimiter, ignore_empty, text1, [text2], …, [text252]) ... where ...
Greedo's user avatar
  • 2,635
1 vote
1 answer
147 views

I am attempting to find the maximum value and its location in multidimensional array using Matlab. There are functions findMax3, ...
JimmyHu's user avatar
  • 7,575
6 votes
3 answers
2k views

I implemented a basic dynamic array using C++. When deleting an element and shifting the others, the last element will be twice repeated (the original still exists after copying). I want to avoid ...
Youssef Refaat's user avatar
1 vote
1 answer
295 views

We have been given two sorted arrays and a number K . We have to merge the two sorted arrays in the sorted manner and return the element at the Kth position. My approach is to use two variables ...
Aryaman 's user avatar
1 vote
1 answer
62 views

I want to convert string to object array. Suppose I have following string. const str = "someValue,display"; I want to convert it like following. ...
ketan's user avatar
  • 113
3 votes
3 answers
645 views

Imagine you want to reserve a classroom over several days. You get a schedule, from the school, telling you when a certain classroom is still free. To make it easy for your students, you want to ...
KIKO Software's user avatar
2 votes
2 answers
2k views

I have this array with dates. All the dates are checked before creating the array with preg_match and check_dates. GoodDates ( ...
Nasty Phoenix's user avatar
0 votes
1 answer
237 views

I got a number that can range be either 10, 20, 30, 40... up until 100. I'd like to make an array from that number. The array should be structured as follows: If the number is ...
Reinier68's user avatar
  • 127
3 votes
1 answer
388 views

I wrote this code in c#. It is a question from LeetCode, number 49. Given an array of strings, group the anagrams. The examples it gives are: ["eat","tea","tan","...
xtryingx's user avatar
5 votes
1 answer
198 views

I have an array wrapper class that I'd like to get reviewed. There are two differences with other common questions on this site. First, my class needs to be "nullable", where a "null ...
thc's user avatar
  • 195
4 votes
3 answers
832 views

I'm new to programming and was tasked with programming a generic circular FIFO queue, without using anything but an underlying array and self-programmed methods. I still don't know how to approach ...
deutschistschwer's user avatar
1 vote
3 answers
214 views

Need help to optimize the following code for lower time complexity: ...
Soumya Charan Das's user avatar
2 votes
2 answers
105 views

I have a little project, chuy, which is basically a copy of Make. By request of users I have added support for toml configuration, since originally it only accepted ...
Eliaz Bobadilla's user avatar
1 vote
1 answer
2k views

I have this type of table: ...
aurepito's user avatar
0 votes
2 answers
2k views

...
flamethrower10's user avatar
1 vote
1 answer
446 views

With this data I am returning one object per keyword prioritising preferedDomain string on domain and then its higher ...
Álvaro's user avatar
  • 187
1 vote
1 answer
137 views

I have a short bit of TypeScript code that looks like the following: ...
Julian Lachniet's user avatar
2 votes
0 answers
389 views

PROBLEM: I need to merge the columns by identifying the headernames and they work as desired by using the below code. The code is very inefficient as I am using an eval to accomplish the job and I ...
user16731842's user avatar
2 votes
2 answers
163 views

I am working on a Data-based application. I wrote a code to filter the table. The table has String and Numbers. I some filter ...
Rohit Nishad's user avatar
1 vote
1 answer
413 views

I am asked to implement the following part of code into kernel code. Actually, I have tried but not sure about the std::array. This is the original code for the ...
user247399's user avatar
2 votes
1 answer
425 views

What I'm trying to do is quite simple: my table has pagination. So if I have 12 items to show and my max items per page is 10, I will have 2 pages, one with 10 records and another with just 2. I ...
Pelicer's user avatar
  • 123
1 vote
2 answers
1k views

I have array [1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4] so I want to move all duplicates at the end of the array [1, 2, 3, 4,1, 2, 2, 3, 3, 4, 4, 4]. is there is another best way to do the same Go Time O(n)...
Manjeet Singh's user avatar
7 votes
1 answer
366 views

I recently got this question in an exam, this is how I implemented, it is working fine. However, I would like to know if the code can be improved, as I think it for sure needs to be improved. The ...
isanma's user avatar
  • 73
1 vote
2 answers
223 views

I have two ArrayLists of objects and the after comparison I am taking out the value which has a difference based on the attribute. So in my condition when the ...
David's user avatar
  • 111
1 vote
3 answers
109 views

Hello I have this function that looks for nested value 3 levels deep currently ...
Mateen Kazia's user avatar
1 vote
1 answer
71 views

The aim of the implementation is divide an array to two sub array which the total of the every sub array should be equal. If Array is dividable then method return ...
Neslihan Bozer's user avatar
4 votes
4 answers
251 views

I would like the array elements to minimize by preserving their orders. For example: 3,7,9,7 is given 1,2,3,2 is yielded ...
Soner from The Ottoman Empire's user avatar
1 vote
1 answer
145 views

My generic 3 median quicksort: ...
NoobProgrammer's user avatar
10 votes
4 answers
3k views

I recently tried to solve the first non-repeating character problem. Please tell me if my solution is valid. I'm aiming for O(n) with a single loop. My thinking is, it would be easy to tell you what ...
zing's user avatar
  • 203
2 votes
1 answer
86 views

I'm playing around with understanding array looping speed. I'm trying to make the contenders equivalent and close to realistic. Is this a good approach? Are there other iteration approaches to test? ...
GollyJer's user avatar
  • 375
1 vote
4 answers
1k views

I have been on the C++ learning grind for the last 2 weeks using caveofprogramming videos so don't judge too hard if this seems like a dumb question. My last lesson covered arrays and the assignment ...
NOKLOCPLUS's user avatar
1 vote
1 answer
3k views

QUESTION: You will set up simultaneous thumb wrestling matches. In each match, two trainers will pair off to thumb wrestle. The trainer with fewer bananas will bet all their bananas, and the other ...
KSP's user avatar
  • 27
2 votes
4 answers
306 views

Coming from a Java/Scala background with a strong focus on OOP+FP, I recently started working with Excel+VBA to implement a front-end for a SaaS. It was like stepping way back in time, over two ...
chaotic3quilibrium's user avatar
1 vote
3 answers
369 views

...
Epsilon's user avatar
  • 153
1 vote
2 answers
127 views

I'm looking at improving my PHP knowledge and wondering if anybody has any tips on improving and optimising my function below? ...
stu's user avatar
  • 21
5 votes
3 answers
564 views

I am working on a basic Array rotate code for a Hacker Rank challenge. The code is complete and passes all test cases, except for 2 which it times out on. I was wondering if there is a way to make ...
Richard McCormick's user avatar
1 vote
1 answer
100 views

Following idea: There are three married couples and they have to be introduced another. I have implemented this solution: ...
michael.zech's user avatar
  • 5,042
2 votes
1 answer
311 views

Given an array of pairs, for example: [["Denver", "Miami"], ["Miami", "Tulsa"], ["LA", "Okmulgee"], ["Mobile", "Portland"...
JB Wilson's user avatar
  • 123
2 votes
2 answers
132 views

Example 1 input:3 output:0011 Example 2 input : 15 output: 1111 in the below example code 15 is input. I have taken 8 4 2 1 as array for Binary coded decimal numbering this code is working as ...
Ramakrishna's user avatar
3 votes
3 answers
1k views

Loop through a given array 7 times and print the following output: int[] arr = { 9, 2, 7, 4, 6, 1, 3 }; ...
Ramakrishna's user avatar
11 votes
3 answers
2k views

Here is a blit function for a graphics library I made. I've built a small graphics library that uses an palette-indexed spritesheet to hold all of the game's sprites. The blit function copies parts of ...
coqcauderanais's user avatar
3 votes
1 answer
348 views

I need to update a multidimensional array by same key paths of a multidimensional array. I think my code can be better condensed : ...
aurepito's user avatar

1
3 4
5
6 7
43