FastPrepSort an Absolute-Value-Sorted Linked List
Problems/Sort an Absolute-Value-Sorted Linked List

Sort an Absolute-Value-Sorted Linked List

Bloomberg LP logoBloomberg LP● MediumNEW GRADONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a firsthand Bloomberg on-campus new-grad interview. In our version, you reuse the list nodes, and the list is already sorted by absolute value without going down.

A singly linked list is sorted by nondecreasing absolute value. Rearrange its existing nodes so their integer values are in ordinary nondecreasing order and return the new head.

Function

sortAbsoluteList(head: ListNode) → ListNode

Examples

Example 1

head = [1,-2,-3,4,-5]return = [-5,-3,-2,1,4]
head
1-2-34-5
→
return
-5-3-214
Moved or new

Negative nodes reverse magnitude order before the positive nodes.

Example 2

head = [-1,-2,-3]return = [-3,-2,-1]
head
-1-2-3
→
return
-3-2-1
Moved or new

All negative nodes reverse.

Constraints

  • The list has at most 10^5 nodes.
  • Absolute values are nondecreasing along the input list.

More Bloomberg LP Onsite Interview questions

  • N-ary Index-Path Encoder and DecoderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Top K Frequent WordsONSITE INTERVIEW · Seen Nov 2026
  • Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Word SearchOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Design Browser HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Mutable Stock Price Top KPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Add Two Numbers IIPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Decode StringPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Minimum Replacements to Make Two Strings AnagramsPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
  • Currency Conversion RatePHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026

Similar questions at other companies

  • Sort a Linked List in Descending OrderMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Minimize Task Resource ConsumptionNVIDIA · OANVIDIA interview questions
  • Merge Timestamped Record ListsNuro · PHONE SCREENNuro interview questions
  • Filter Linked-List Nodes and Keep Top KGoogle · PHONE SCREENGoogle interview questions
  • Chain MergeRubrik · OARubrik interview questions
  • Build a Sorted Circular Singly Linked ListAnduril · PHONE SCREENAnduril interview questions
  • Sort a Linked ListAdobe · PHONE SCREENAdobe interview questions
  • Merge K Sorted Linked ListsBharatPe · PHONE SCREEN
  • LRU Cache for Query ResultsAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Mutual-Friend RecommendationsMeta · PHONE SCREEN · ONSITE INTERVIEWMeta interview questions

Bloomberg LP interview experiences

  • Bloomberg AI-Assisted Coding Round, All Levels: 14 Experiences
  • Bloomberg SWE Intern Interview Questions: 68 Questions
  • Bloomberg Interview Questions, Level Not Reported: 65 Questions
  • Bloomberg Experienced Design & More: 126 Questions (Part 2 of 2)
  • Bloomberg Experienced SWE Interviews: 167 Questions (Part 1 of 2)
  • Bloomberg New Grad Coding Questions: 121 Questions (Part 2 of 2)
All Bloomberg LP interview questionsSee Bloomberg LP hiring insights
Saved
/**
 * Definition for singly-linked list.
 * public class ListNode {
 *     int val;
 *     ListNode next;
 *     ListNode() {}
 *     ListNode(int val) { this.val = val; }
 *     ListNode(int val, ListNode next) { this.val = val; this.next = next; }
 * }
 */
class Solution {
    public ListNode sortAbsoluteList(ListNode head) {
      // Write your code here.
    }
}
Checking account…