Dust and Stars - 1992 | Chapter 178 | Boundary Conditions | English
After `import sys`, the cursor blinked steadily in the blank space. The forty-eight-hour countdown began at that very second. Lin
Chapter 178: Boundary Conditions
After import sys, the cursor blinked steadily in the blank space. The forty-eight-hour countdown began at that very second.
Lin Chen did not rush to write the logic. He pulled out a sheet of A4 scratch paper and drew a timeline down the center with a pencil. Phase noise, sliding window, O(n) time, O(1) space. The problem statement was clean, stripped of unnecessary ornamentation, but all the traps lay hidden in the boundary cases. Industrial data was never the perfect sequence from a textbook; breaks, spikes, and out-of-range values were the norm. He had to filter out the noise without allowing memory usage to expand.
He closed his eyes and tapped his fingers soundlessly on the desk. If a sliding window stored historical values, the space complexity would inevitably be O(k). To compress it to O(1), he could only maintain the window’s statistical features, or use mathematical recursion to cancel out redundancy. He thought of the moving average filter he had used before while calibrating registers at the provincial metrology institute, but that had been a hardware-level accumulator. In software, direct accumulation would overflow. He would have to use a differential approach.
He opened his eyes and wrote down the recursive formula on the paper: S_new = S_old + x_in - x_out.
But the noise was not uniformly distributed; it needed weighting. He switched to a variant of the exponential moving average, keeping only the previous state value and the current input so that space usage stayed constant. A single pass through the array would satisfy O(n) time.
Once the logic was clear, he switched back to the editor. The bandage around his left ankle had already stiffened dry, and it sent a dull ache through him whenever it rubbed against his shoe. He turned up the desk lamp, took the ice pack out of the shockproof case, and pressed it beneath his knee through a towel. Cold compresses could suppress the abnormal firing of the nerve endings. Then he set an alarm on his phone: forty-five minutes. When the time was up, he had to stand and move, even if it was only to go to the doorway for a cup of water. The code could not stop, but his body could not collapse.
His fingertips dropped to the keyboard.
He wrote the data ingestion module first, using sys.stdin for streaming input so a large file would not flood memory if loaded all at once. Then came the core filtering function. The variable names remained minimal: prev_state, curr_val, alpha. No flashy decorators, only the most basic loops and conditional branches. He deliberately avoided Python list comprehensions and used native iterators instead, reducing temporary object allocation. Every time he finished a function, he benchmarked it once with time and tracemalloc. In the lower-right corner of the screen, the memory-usage curve stayed flat against the horizontal axis.
By three in the morning, the dorm building had sunk fully into sleep. His roommate across from him turned over once, and the bedframe gave a faint creak. Lin Chen put in his noise-canceling earplugs, and the world was shut away behind a pane of silence. There was only the clatter of keys and the low hum of the fan.
When he got to the exception-handling module, his left foot suddenly cramped. The muscle spasmed out of control, his toes pressing hard against the sole of his shoe. He stopped typing, clenched his back molars, and waited for the electric pain to pass. Sweat slid from his temple to his chin and dripped onto the draft paper, blurring the four characters for “boundary conditions.” He did not wipe it away. He simply pulled his foot out of the shoe, held it suspended, and gently massaged his calf.
Five minutes later, the spasm subsided.
He put his hands back on the keyboard.
He had built the test cases himself: an all-zero sequence, an all-noise sequence, missing values at the beginning and end, floating-point values in the millions. The script ran through once, and the log output was neat and exact:
[INFO] Processed 1000000 records. Time: 0.42s. Peak Memory: 1.2MB.
It met O(n)/O(1).
He checked for floating-point precision issues and replaced the default float with the decimal module to avoid accumulated error. At the end, he wrote a simple performance report template and filled in the test data, environment configuration, and explanation of the core logic. No wasted words—only parameters and conclusions.
Save. Package.
Filename: LinChen_SlidingWindow_Filter.tar.gz.
He leaned back in his chair and closed his eyes. Suddenly, his mother’s voice from the phone surfaced in his mind: “The New Rural Cooperative Medical Scheme payment notice has been posted at the entrance to the village. Your father said to prioritize your travel expenses first.”
Then the screenshot of the account balance in the drawer: 7135.30.
The boundary conditions in life were far harsher than those in code. When code crossed a boundary, it threw an error. When life crossed one, it meant no medicine, no food, no way back. He could not afford to be wrong.
He dragged the compressed file into the email attachment field, filled in the recipient, and typed the subject line:
【Technical Initial Screening】Lin Chen - Sliding Window Filtering Algorithm Submission
He clicked send.
The progress bar filled, then the notice appeared: Delivered.
He cleared the drafts and shut down the editor. His left foot had already gone numb, but he could feel the blood beginning to flow back through it. He stood and hopped on one leg to the washroom, splashing cold water over his face. In the mirror, the man staring back at him had hollow eye sockets and fresh stubble, but his gaze was steady.
When he returned to his seat, his phone screen lit up. It was not a reply from HR, but a WeChat message from Professor Zhou:
“Friday at two in the afternoon, there’s a joint technical interview with a company at Provincial Institute of Technology. I signed you up. Bring your project notes. Don’t be late.”
Lin Chen stared at the line of text.
Friday at two.
He ran through his schedule in his head at once. Friday afternoon was exactly when the hands-on portion of the provincial computer proficiency exam he had registered for would be held. The testing site was in the north of the city; the technical interview was in the south. With subway transfers alone, it would take at least an hour and a half. With the way he was walking now, there was no way he could make it in time.
He set down his phone and opened the calendar app. The two appointments overlapped like two parallel lines that could never intersect. He picked up his pen and drew an X on the paper.
No complaint. No panic.
He simply began listing possibilities: Could the practical exam be postponed? Could the technical interview be joined online? If neither was possible, which one should he choose?
He pulled up the operations manual from the Academic Affairs Office website. A deferred exam required documentation from a Class III hospital, and each student was allowed only one per semester. His injury diagnosis was still at the county hospital. Getting the proof would take two days round trip—far too high a time cost. Online access would require the company to open remote permissions, and the initial screening email had said nothing about it. The probability was extremely low.
That left only one choice between two.
He opened Excel and created a new decision matrix. The horizontal axis was “practical certificate,” the vertical axis “technical interview opportunity.” The practical certificate was a hard graduation requirement; without it, he would not receive his degree, and all the registration fees and time he had already invested would be wasted. The technical interview, on the other hand, was a connection Professor Zhou had personally arranged. If he passed it, he could go to Shenzhen, earn an internship salary, and directly cover his younger brother’s medication next month as well as his own travel expenses.
The weights were clear on paper.
In reality, every option was sunk cost.
He crossed out “give up the technical interview.”
It was not that he did not want it. It was that he could not afford to gamble. Professor Zhou’s resources were a one-way road. If he missed this chance, there was no knowing how many months he would have to wait for the next. His brother’s sodium valproate could not be interrupted. His mother’s payment notice could not be delayed.
He had to find a crack of space between the two lines.
He reopened the browser and searched for “provincial computer-based exam alternate test site transfer.” The policy document was written in stiff, official language: cross-city transfer was, in principle, not permitted, but applicants with special injuries or illnesses could apply for a backup testing room, provided they submitted an application and medical proof forty-eight hours in advance.
He checked the time. There were still three days until Friday.
He grabbed his coat and stuffed the medical record book and X-rays from the shockproof case into his backpack. His left foot slid into the shoe, and pain stabbed through him, but he did not stop.
Before leaving, he turned back for one last look at the desk. The screen had gone to sleep; the shockproof case stood quietly in the corner like a mute boundary marker. He knew that multiple-choice options were never perfect—but the person making the choice had to bear the consequences. He took his keys and locked the door. The motion-sensor lights in the corridor blinked on one by one with the sound of his footsteps, then went dark one by one behind him.
He went down the stairs and pushed open the dormitory’s main door. The morning wind, carrying the scent of dew, struck his face. He hopped down the steps on one leg. His right foot hit the ground heavily, but the rhythm did not break. His phone vibrated once in his pocket—a bank notification about a balance change. He glanced at it without unlocking the screen.
He knew that the next round of comparison would not happen inside a server, but in the path planning of real life.
He quickened his pace and headed toward the campus hospital.
More from WayDigital
Continue through other published articles from the same publisher.
Comments
0 public responses
All visitors can read comments. Sign in to join the discussion.
Log in to comment