About 50 results
Open links in new tab
  1. python - LeetCode 977: Squares of a sorted array, maintaining non ...

    Feb 9, 2025 · I tried solving the LeetCode question like many others, trying to incorporate the O(n) time complexity requirement. Squares of a Sorted Array Given an integer array nums sorted in non …

  2. Turn array of objects into date-sorted array of objects

    Jan 7, 2022 · First, I create an object with dates as the key and arrays of logs as the value Then, I convert this object into an array of objects Then, I sort of the array by date. Is there a way to build …

  3. Sorting based on multiple fields using IComparer

    Nov 15, 2021 · I use the below code to sort List<DataAccessViewModel> list. Here is the sort order : PriorityScore MName CName FName It works as expected. public int …

  4. Angular, sort objects by their keys - Code Review Stack Exchange

    Apr 24, 2018 · 3 I had to sort a list of objects - {name:'name', email:'email} by their keys, ex. by email, so they all be rendered with email key/value pair as a first key/value pair and I was surprised about the …

  5. Sorting array by odd numbers while leaving the even numbers in the …

    Jun 23, 2023 · The problem given was: "You will be given an array of numbers. You have to sort the odd numbers in ascending order while leaving the even numbers at their original positions." I developed a

  6. Sorting an array by given hierarchy - Code Review Stack Exchange

    Feb 1, 2023 · Sort an array of numbers by another predefined, non-exhaustive array of number, then sort ascending Custom sort an associative array by its keys using a lookup array

  7. Randomly generating a sorted array - Code Review Stack Exchange

    Aug 15, 2014 · I'm writing a method that generates a random integer array that are sorted. It takes the arguments of min value, max value and the length of desired array. So for example the arguments …

  8. Sorting an array of integers in C++ - Code Review Stack Exchange

    Sep 5, 2020 · Really, the only way to optimize a bubble sort is to use a different algorithm. Which is a principle applicable in many cases :-) Unless you're doing this as a class assignment or similar, your …

  9. php - Sort array of dates - Code Review Stack Exchange

    Sep 15, 2021 · 0 You could also use the PHP DateTime class together with array_map. This would remove the need for checking dates and writing your own sort function.

  10. Improving performance when sorting array of structs by multiple fields

    I have an array of a struct containing 5 byte values. I need to sort this array by each value in a different order depending on the situation. These arrays are sometimes quite small (10-30 element...