Stable Odd-First Partition
Updated
Problem statement
Return a new array containing every odd value from nums first, followed by every even value. Preserve the relative order within both groups.
Negative integers use ordinary divisibility by 2; for example -3 is odd.
Function
stableOddFirst(nums: int[]) → int[]Examples
Example 1
nums = [2,3,4,1,6,5]return = [3,1,5,2,4,6]Both the odd and even subsequences retain their input order.
Constraints
0 <= nums.length <= 10^5.
More Bloomberg LP Onsite Interview questions
- Pascal's TrianglePHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
- Valid Triangle NumberPHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
- Collatz Conjecture with Shared MemoizationPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Word SearchOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- 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
- 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
Similar questions at other companies
- Sparse Vector Dot Product from TuplesMeta · PHONE SCREEN · ONSITE INTERVIEWMeta interview questions
- Best Average Student ScoreGoldman Sachs · PHONE SCREEN · ONSITE INTERVIEWGoldman Sachs interview questions
- Flood FillAmazon · ONSITE INTERVIEW
- Streaming Entropy, Part 1: Batch EntropyOpenAI · PHONE SCREEN · ONSITE INTERVIEWOpenAI interview questions
- Two SumShnoor International · ONSITE INTERVIEW
- Count Distinct Pairs With Sum KeBay · ONSITE INTERVIEWeBay interview questions
- Bad Request AlertsMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
- Confusing Bib NumbersVerily · ONSITE INTERVIEW
- Group Transactions by HourAffirm · ONSITE INTERVIEWAffirm interview questions
- Longest Common PrefixKotak Mahindra Bank · PHONE SCREEN · ONSITE INTERVIEWKotak Mahindra Bank 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)