Want to know:
counting sort?把值为i的放到i - 1位置上最后遍历,不对应的就是缺失的 for (int i = 0; i < nums.length; i++) { while (nums[i] != i + 1 && nums[i] != nums[nums[i] - 1]) { int tmp = nums[i]; nums[i] = nums[tmp - 1]; nums[tmp - 1] = tmp; } } List<Integer> res = new ArrayList<Integer>(); for (int i = 0; i < nums.length; i++) { if (nums[i] != i + 1) { res.add(i + 1); } }
Get a detailed, AI-powered explanation for this question and thousands more on StudyFetch.
Get the Answer for FreeHow StudyFetch Helps You Master This Topic
AI-Powered Answers
Get instant, detailed explanations powered by AI that understands your course material.
Deep Understanding
Go beyond surface-level answers with step-by-step breakdowns and examples.
Personalized Learning
Sparky adapts to your learning style and helps you connect ideas.
Practice & Test
Turn any question into flashcards, quizzes, and practice tests to solidify your knowledge.
Explore More Questions
- Ursa Major Solar is looking to reduce support costs by allowing customers to work together to answer one another's questions and solve problems. Which feature should a Salesforce admin use to allow its customers to interact with each other and share best practices?
- 1. ________ technology allows a videoconference participant to give the appearance of being present at a location other than his or her true physical location. Telepresence Virtual reality Screen sharing Mind mapping Virtual world
- In the classic prisoners' dilemma, the Nash equilibrium is called: Cooperative solution Non-cooperative solution Strictly dominated strategy None of these