Full Width [alt+shift+f] FOCUS MODE Shortcuts [alt+shift+k]
Sign Up [alt+shift+s] Log In [alt+shift+l]
3
Dave 2:41 – yoo i took a nap wanna play minecraft? actually i need your help with something what just come over kk i gotta shower Dave knew stuff about computers. Don’t let the being high all the time fool you, he was the smartest guy in our friend group. And he was the most chronically online. He showed up on his bike 20 minutes later. “Yo,” I yelled to him across the lawn. “Dude what’s up? You look rattled” “My mom is missing and she isn’t answering her phone. Then I tried to track her on the car app, but somebody changed the e-mail.” Dave came inside the house (I locked the door behind him) and opened his laptop at the kitchen table. I messaged him the VIN, and he tried the reset e-mail again but on the website. Same result. Same skinner666 “What did the e-mail used to be? Do you have access to that account?” “Yea,” I brought up the password to bakerfamily43@gmail.com on my 1Password and Dave logged in on his laptop. We saw like 15 e-mails notifying that account details were...
2 days ago

Comments

Improve your reading experience

Logged in users get linked directly to articles resulting in a better reading experience. Please login for free, it takes less than 1 minute.

More from the singularity is nearer

chapter seven: nudge

“Why are you here on a Sunday?” “John’s in town,” I said. “And he knows I’m looking for him.” I’ve carried this case for five years. When Operant moved its compute out to Long Island—cheaper power, easier permits—it landed in my world by accident. Detective James Reese, Nassau County Police. Since then, every time I think I’ve got a straight line, the story bends. People call it “mind control.” That’s the wrong phrase. You hear that and you start hunting for sci-fi. What you should be hunting for is timing. There are the clean facts. It started with a private investigator caught at night inside Jane Street’s office. He was there to plant a device. Not a camera, not a mic. A flat plastic square the size of a drop ceiling tile, featureless, no lens, no obvious grill. If you tapped it with a knuckle it sounded dead, like dense foam. The FBI took the evidence, said as little as possible, and then Trump dissolved the Bureau and the chain of custody with it. The PI pled to B&E, did eighteen months, swore a friend offered him ten grand and a location. The friend never existed long enough for us to find. While the tile vanished, Operant didn’t. They grew. They put their name on the Ducks’ ballpark, donated to everyone they should, and pushed eight percent of Long Island’s power through their meter. Every time I asked questions, a lawyer answered them. I still have a job mostly because I don’t stick my questions in microphones. But the corporate espionage wasn’t the hook. The hook’s name was Tom Park. Young, gifted, on Operant’s “research” payroll. He died off the roof of their building. We asked for the CCTV. They delayed until the delay became its own story, and when the files came they were grainy enough you could convince yourself resolution had gone out of style. We couldn’t prove a cut. We couldn’t prove a lie. We could see a silhouette on the roof with a phone in his hand, see him put it away, and watch him walk forward like he’d decided to walk forward an hour ago. We pulled his phone records. The carrier said the device never left his parents’ house that night. The family’s router logs said the same thing—MAC associated all evening, steady signal, Netflix on the downstairs TV. At the time of death the rooftop access point didn’t record a roam. No one found a phone with the body. If you’re generous, you call that “inconsistency.” If you’ve been around long enough, you call it “choreography.” I didn’t see the tile again, but I kept a copy of the photos and I stared at the connector pads until I’d memorized the geometry. Four edge pads, power bus shape. Months later, a fire inspection at an Operant satellite site flagged “non-listed luminaires with integrated driver boards.” That’s code for “custom lights.” The brand on the sticker didn’t exist in any registry. It matched nothing you could buy. What does a ceiling tile do if it isn’t a ceiling tile? You can guess: a planar array under plastic, phaseable, a clock inside that doesn’t drift. You don’t need to read thoughts. You need to make the room keep time. We ran a small experiment in our squad room. Nothing that requires approval. We set up a tapping game on a laptop—left or right as quickly as you can when a cue appears. We added a desk lamp we could modulate in the last hundred milliseconds before the cue—no visible flicker, just PWM phase changes—and a piezo disc under the mouse pad that could make a vibration too soft to notice unless you were trying to notice. We told the script to wait until the model thought the subject was likely to pick left, then line up the lamp phase and the tick so “left” felt a hair earlier. The hit rate shifted eight points. The officers said it felt like the computer was “on it” that round. No one said they felt pushed. That’s the thing about timing: when it works, it feels like you were going to do it anyway. I went back to Tom. We subpoenaed what we could: badge swipes, elevator logs, building automation schedules for lights and HVAC. The elevator cabin he rode at 23:41 ran a “door nudge” cycle at floor 35—exact term in the manual. Not a stop, a shove. At the same minute the east conference rooms above ran a luminance ramp—35 to 50 percent and back down—logged as a “pattern test.” Two minutes later the air handlers kicked a “night purge,” unscheduled. The lobby mic’s spectrogram shows the change as a clean band sliding up. None of those facts make a person move. Together they draw a rhythm line through a building. We never found what Tom had in his hand, his “not a phone,” but a year after his death, one of their contractors quit and dumped an issue tracker on a public repo by accident. It was up for an hour before it vanished, but the internet is full of raccoons, and one of them sent me a ZIP. Half the issues were boring—install scripts, driver mismatches, bad GPIO pull-ups. The other half had words like “phase,” “latency,” “confidence gate,” “avoid visible artifacts,” “EEG-free,” and the tag “ROOM.” There was a set of comments on a bug titled “End Token Misfires.” The engineers were arguing about whether printing the full predicted sequence at the start of a session biased the subject into making it true. One person said that was the point. Another said if your only wins are the ones you can cause you aren’t measuring prediction anymore, you’re measuring control. The thread ends with a “resolved—won’t fix.” Mind control isn’t the right term. It makes people look for sci-fi. The right term is “nudge,” the one the elevator manuals use. You put your thumb on the timing. You don’t push the person; you lean on the moment. Tom stood on a roof with a clock in his pocket that belonged to the room, and a room that belonged to the company, and a company that had learned you can make a person look like a prediction if you take away all the moments where they would have surprised you. Sometimes I think the real trick isn’t the tile or the lights. It’s the bookkeeping. You arrange your systems so that there’s nothing to subpoena. The carrier shows a phone at home. The Wi-Fi shows a phone at home. The building shows a test pattern and a purge cycle and a polite door. Nothing is illegal in a log file. I keep a copy of that ZIP on a USB stick in my desk. There’s a folder called “SAFE_GATES” with a README someone wrote in plain English. “Do not schedule interventions if subject arousal > threshold. Do not schedule end token if subject mentions self-harm. Cooldown after consecutive errors.” Half the rules are commented out. The most recent commit message is just a shrug emoji. The worst part is how ordinary it all is. The elevator nudge. The lamp nudge. The HVAC tone. The not-a-phone. If you want to find the devil, you don’t go looking for horns. You go looking for clock edges. I told my sergeant I was taking the rest of the day. I stopped by a hardware store and bought a dimmer I knew I could open, and a roll of white tape. Back at the office I put a strip of tape on the lamp in interview room two, covering the LED that the supplier put there to indicate “smart mode.” We don’t use smart mode. We don’t use anything with a mode. When I left, the room looked like every other room. That’s the point. You only notice the timing when it slips. On the way home I drove past the Ducks ballpark. Operant’s name on the sign looked like every other naming deal. Families walking in, kids with foam fingers, warm light over the field. If you didn’t know to look, you’d think it was all just baseball.

2 days ago 2 votes
chapter five: sleuthing

Mom 12:37 – hey when are you getting home? Dave You set the disappearing message time to 3 hours hey you doing better lol yea i really didn't sleep much what's up u didn't set timeout for that yea is what Brian said true what did he say about how Tom worked at operant? yea why? you know that's where my dad worked and he kind of went crazy too do you know what he did there? not rly my mom gets real upset when i bring it up it was some math shit with magnets wanna come over and ask her lol I did not want to have a conversation with Dave’s mother. 12:55 – haha im good but im just chilling at home if you want to come by here The doorbell rang again. Resolving to be less of a pussy, I answered it. I was prepared to talk to the cops. Polite, short answers, step outside and lock the door, find out what they want. Not a pussy. Not a pussy. Not a pussy. It wasn’t the cops. It was my Mom’s friend Anne, and I told her she wasn’t here. It was always strange to me that that generation would just drop by. Like she didn’t text her first? She said she was in the neighborhood and had extra bagels she wanted to drop off. I thought about telling her that I hadn’t heard from my Mom since yesterday and that she didn’t reply to my text, but decided against it. I didn’t know the dynamic of my Mom’s friend group. Maybe she is out sleeping with Anne’s husband or something. I didn’t want to be a link in the chain of Anne finding out. I was vague but very polite. Anne left the bagels. I didn’t touch the bag. I went up the stairs to my Mom’s room. Did I mention how much I like true crime? It’s probably done bad things for me personality wise. I know that the people on there are out of the normal distribution of people, but those podcasts are one of my only exposures to the outside world. The world beyond this little slice of Brooklyn. So you kind of start thinking everyone is like that. I’d always just assumed my Dad was like, a Wall Street guy. Boring. Get money, fuck bitches. When I was little we had tons of money. We lived in a huge house in Cobble Hill. I flew first class to Europe when I was 7. We spent a week on a yacht in Monaco. My mom loved the luxury lifestyle, and would put up with a lot of my Dad’s eccentricities to keep it. When he left she didn’t seem that upset though. I think the money was still coming in from him, which was the main thing she cared about. It clearly wasn’t as much, we moved out to Sheepshead Bay and never went back to Europe. But she didn’t work and I always got good birthday presents, and she never said anything bad about my Dad, so I assume that’s where the money was coming from. The first drawer I opened had sex toys in it. I saw a vibrator and a butt plug before I quickly closed the drawer. The second drawer had socks. The third drawer had tons of scattered papers. My college rejections. Some essays from high school. A note written in crayon about how I wanted a Nintendo Switch for Christmas. I guess this was the “me” drawer. The fourth drawer was papers, but more organized. My parents marriage certificate. My mom’s birth certificate. My old passport. As far as I knew, they never got a divorce. He just left. Then, something I didn’t know. A document entitling one Jessica Baker to $10,000 per month, to be paid out on the first of every month by the Triangle Trust, for the rest of her natural life, or until the trust is dissolved. That was nice of my Dad. I went through the rest of the drawers, but didn’t find anything else interesting. I put everything back as carefully as I could. I considered that someone might dust for fingerprints. I wondered if I did anything illegal. I live here, right? I checked on the text message to my Mom and noticed that it hadn’t been delivered. This was really unlike her. Sometimes she’d go out drinking and meet a guy and stay out all night, but she’d always at least text me by the morning when she sobered up. 2:14 – are you okay? Not delivered. Maybe her phone died? Nah but it’s the afternoon she probably would have charged it by now. I tried calling. Straight to voicemail. I checked the Mercedes app to see where her car was. She’d let me take the car sometimes, so we were both on the app. It asked me to login. I copied the password from 1password. Incorrect Password Maybe she changed it? I tried to set her up on 1password but she didn’t get it. She’d just reset the passwords when she needed to login. Ugh, logging into stuff is the worst. I clicked the reset password and typed in the e-mail. There is no account with that e-mail Okay, that doesn’t make sense. My Mom and I shared an e-mail for this stuff, and she wouldn’t change it without telling me. I clicked forgot e-mail. It needed the VIN of the car. The title was in the fourth drawer with the other papers. I went and got it and typed in the VIN. The e-mail associated with your account is: skinner666@gmail.com A jolt of anxiety coarsed through my body. I’d never seen that e-mail address in my life.

2 days ago 4 votes
chapter four: the bagel shop

“Earth to Dave.” Brian rapped his knuckles lightly against Dave’s head. He snapped back into it. “This nice lady wants to know what kind of bagel you want” It was so like Brian to call the woman at the counter a nice lady. At some point, he’d watched American Pie and thought Stifler was how people should be. Or maybe he was just always like that and the movie made him think it was acceptable. He called himself a gentleman, but not in the creepy Elliot Rodger way, or in anything resembling the real meaning of the word. I think he just thought it was funny how that word got a rise out of people. Dave replied, “uhhh a cinnamon raisin…with uhh…butter…yea butter.” Even the nice lady knew Dave was high, Brian and I ordered normal bagel sandwiches and here was Dave ordering dessert. Brian paid for the bagels with his mom’s credit card and told us we could Venmo him later. His mom’s credit card and we Venmo him. That’s the type of guy he was. “He didn’t leave last night. Passed out right where he was sitting,” Brian spoke about Dave like he wasn’t there. This would happen sometimes. Like we would smoke and get high, but for Dave it was a different thing. He would smoke till he was catatonic. He was also the first one in our friend group to start smoking. Dave’s older brother killed himself when we were freshmen, and that’s around when it started. A coping strategy. It wasn’t just the loss of his brother, his mom was never the same afterward. I don’t think I saw her out of the house after that; Dave said she barely left her room. The overall downer atmosphere was too much for his sister and she moved to California as soon as she could. He was all that was left. Dave got quiet after that. Maybe it was the weed, maybe it was the pain, but he started riding his bike to school every day and doing really well in classes. His brother was some kind of wunderkind; maybe he thought if he was like that his mother would stop moping. He graduated valedictorian and she never did. Maybe that wasn’t enough? “I thought we were gonna have a party last night,” I mentioned offhandedly. Brian’s parties weren’t the Met Gala, but it was usually more than just the three of us. I was hoping Ari was going to be there. “Hoping Ari was gonna be there?” Oh God even when I say something so innocuous Brian knows what I’m thinking. “Nah, we found the Volcano and didn’t really want to text anyone else after that.” “Understandable” “I don’t know if Dave slept. When I came downstairs he had the bag inflated on top of the machine.” He ribbed Dave with his elbow while he said this. “I slept,” mumbled Dave. “It’s called wake and bake.” Dave and Brian both liked 2000s movies, stoner comedies, movies about high school and prom, getting laid. Something about it being a simpler time. They were closer than I was with either of them. Dave would go to dark places and Brian couldn’t be brought there. So it worked. Even though Brian was kind of an asshole, he was a good guy to have around. His dad was a trucker and he wasn’t around much. This is one of the things we bonded over. They called our name and we sat down at a table with the bagels. In the morning the visit from the cops didn’t really seem like much of a big deal, so I thought I’d tell the guys about it. Upon doing so, Brian immediately pointed out something I missed. He asked, “What’s your dad’s name?” and I realized right away. While he went by Jonathan and I went by John, it sure made a lot more sense that the cops were looking for him when they wrote “John.” Lazy cops didn’t even write his full name. He was in town, and he was on Long Island for the meeting. It wasn’t me! “Hey McFly!” Brian mocked. It was clear he’d watched Back to the Future recently and now I see where he got the knuckle rapping too. “You know you gotta stop being such a little pussy all the time.” He put on a high pitched voice that was supposed to resemble mine, “I’m a little pussy, I hide in my room when the cops come and they aren’t even looking for me they are looking for my weird ass dad.” I was too relieved to care about his mocking. Brian continued, “You know that place was into some weird shit. Where your dad worked before he bugged out. Dave’s brother worked there too.” “You mean the one who killed himself?” Immediately I regretted how I said it and looked over at Dave. He was too transfixed by the swirls of cinnamon in his bagel to register anything. Brian scolded me, “dude” and I felt embarrassed. I was so giddy from realizing the cops weren’t looking for me that this crossed over in my head to a true crime podcast, where I was more interested in the mystery than the characters, forgetting that these were real people with real lives. I felt distant enough from my father to view him that way. I don’t know how Dave felt about his brother anymore. I came back at Brian, trying to move past my faux pas. “Well at least my dad did something. Your dad doesn’t even drive the truck! He sits there and watches it drive. A real union man.” Dave now had finished his bagel and put his head down on the table. Brian smiled at the retort, “At least my dad isn’t some kind of Kaczynski freak.” This was the nature of our friendship. Last night I thought my world was closing in, now I realize this just all isn’t my problem. My dad was sort of a Kaczynski freak. Maybe he mailed bombs to people and the cops caught him. Maybe he has some lame manifesto about why he did it. I love reading manifestos. I took out my phone and venmoed Brian for my and Dave’s bagel. We’d venmo him about half the time; Brian’s mom was rich from the settlement and we knew she didn’t care. My mom still wasn’t back when I got home.

3 days ago 5 votes
chapter three

7 years earlier Jonathan sat there while his Mercedes S-Class with DRIVE PILOT drove him across the Brooklyn Bridge to Wall Street. He had been working at Operant Capital for 10 years. The idea was simple. Predict the market, trade based on those predictions, and get rich. The implementation however, was not as simple as the idea. The market doesn’t work like physics. The market moves based on the thoughts and feelings of billions of humans, and they were all trying to do this same prediction thing. That’s what made the economy. Everyone was basically doing this algorithm on some level. And even worse, this was a Red Queen’s race, where the tactics that worked last year didn’t work this year. Everyone was predicting everyone else predicting the market. Except everyone was not as smart as Jonathan. He was a child prodigy. He got his first IMO Gold when he was 14. He graduated from MIT in 3 years. And he wanted a job where he was surrounded by other people as smart as him. He’d been working on the RPS project for the last three years. As one of the more senior people there, he got to work on the more speculative research. Operant was blessed with basically an unlimited budget; the bounties of providing a valuable capital allocation service to the market. Jonathan believed in the mission. Well, mostly anyway. Make markets more efficient. They weren’t a high frequency trading shop skimming pennies off of each transaction by being fast. They weren’t doing arbitrage. They were a market intelligence service. They knew where capital should be allocated before the market did, and in the grand scheme of things, they charged so little for their service. Most of the tricks were standard. The same run of the mill models everyone in the industry was using. But they felt that their differentiator was always remembering that the market doesn’t obey physical laws. Technical analysis is complete bullshit. This is a simple betting game played against other agents. Which is the line of thinking that led to the RPS project. RPS stood for rock-paper-scissors. A game with a simple Nash equilibrium. One-third, one-third, one-third. Deviate at all from that strategy, and your opponent can exploit you. But if your opponent isn’t playing that strategy, you have to deviate to exploit them. Shortly after MRI machines were invented, people started using them to see if they could read minds. They’d put someone in an MRI and give them two buttons, say a red and a blue. Of course the machine knew which button you would press before you pressed it. But what was crazier is that the machine knew which button you would press before you were even aware of your choice. The obvious follow up question is, how much before? Seconds was very believable. But could you know as soon as the subject walked in the room? At the time there wasn’t really a way to explore this. Aside from the 55% prior on red, there wasn’t much more to say. Rock-paper-scissors was basically the same game. Humans do have unequal priors, preferring rock at 35.4%. But is it possible that someone was a scissors type guy? Maybe you could read their social media posts and tell. Maybe you could just tell by looking at their face. The goal of the RPS project was to become perfect at rock-paper-scissors. And the results were very promising. The computer had a win rate of 86%, with a first round win rate of 54%. Once you were playing multiple games it was easy, but Jonathan was particularly proud of the first round win rate. However, 54% wasn’t close to 100%. It was better than random, sure. But this showed diminishing returns. Maybe the data just wasn’t there. Maybe you had to look inside to spot a scissors type guy. The new research direction was outfitting the room with SQUIDs, very sensitive magnetometers capable of measuring fields in the femtotesla range. The rules for the project disallowed things that were obvious and bulky like MRIs. But anything that could be put in a normal room was fair game. It was Monday and the more junior people had been there working all weekend. Jonathan had taken his wife and son camping. When he got to the office, he was ambushed as soon as he stepped out of the elevator. “You have to try it,” said Tom with the energy of a kid seeing presents on Christmas morning. Tom was 17, also an IMO Gold winner, and probably the brightest guy on the team. He didn’t go to college, he came straight to work at Operant. Real LeBron energy. Jonathan stepped into the room. He played scissors. He lost. He played scissors again. He lost. He played rock. He lost. He played paper. He lost. He went back to scissors. He lost. He played scissors again. He lost. He stepped back to take a breath. He played rock. He lost. He played rock again. He lost. He walked out the room. Tom handed him a piece of paper. At the top it had the date and 10:09 AM, and had SSRPSSRRE on it. 10:09 was when he walked into the room, and those were all the moves he played. “What’s this E?” “That’s end. It’s when you’d walk out of the room.” “So are you saying…it predicted all of this before I even played one game?” Tom shrugged, “If it knows all the predictions are going to be correct, why does it need any feedback?”

3 days ago 6 votes

More in programming

If Apple cared about privacy

Defaults matter

5 hours ago 4 votes
Many Hard Leetcode Problems are Easy Constraint Problems

In my first interview out of college I was asked the change counter problem: Given a set of coin denominations, find the minimum number of coins required to make change for a given number. IE for USA coinage and 37 cents, the minimum number is four (quarter, dime, 2 pennies). I implemented the simple greedy algorithm and immediately fell into the trap of the question: the greedy algorithm only works for "well-behaved" denominations. If the coin values were [10, 9, 1], then making 37 cents would take 10 coins in the greedy algorithm but only 4 coins optimally (10+9+9+9). The "smart" answer is to use a dynamic programming algorithm, which I didn't know how to do. So I failed the interview. But you only need dynamic programming if you're writing your own algorithm. It's really easy if you throw it into a constraint solver like MiniZinc and call it a day. int: total; array[int] of int: values = [10, 9, 1]; array[index_set(values)] of var 0..: coins; constraint sum (c in index_set(coins)) (coins[c] * values[c]) == total; solve minimize sum(coins); You can try this online here. It'll give you a prompt to put in total and then give you successively-better solutions: coins = [0, 0, 37]; ---------- coins = [0, 1, 28]; ---------- coins = [0, 2, 19]; ---------- coins = [0, 3, 10]; ---------- coins = [0, 4, 1]; ---------- coins = [1, 3, 0]; ---------- Lots of similar interview questions are this kind of mathematical optimization problem, where we have to find the maximum or minimum of a function corresponding to constraints. They're hard in programming languages because programming languages are too low-level. They are also exactly the problems that constraint solvers were designed to solve. Hard leetcode problems are easy constraint problems.1 Here I'm using MiniZinc, but you could just as easily use Z3 or OR-Tools or whatever your favorite generalized solver is. More examples This was a question in a different interview (which I thankfully passed): Given a list of stock prices through the day, find maximum profit you can get by buying one stock and selling one stock later. It's easy to do in O(n^2) time, or if you are clever, you can do it in O(n). Or you could be not clever at all and just write it as a constraint problem: array[int] of int: prices = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8]; var int: buy; var int: sell; var int: profit = prices[sell] - prices[buy]; constraint sell > buy; constraint profit > 0; solve maximize profit; Reminder, link to trying it online here. While working at that job, one interview question we tested out was: Given a list, determine if three numbers in that list can be added or subtracted to give 0? This is a satisfaction problem, not a constraint problem: we don't need the "best answer", any answer will do. We eventually decided against it for being too tricky for the engineers we were targeting. But it's not tricky in a solver; include "globals.mzn"; array[int] of int: numbers = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8]; array[index_set(numbers)] of var {0, -1, 1}: choices; constraint sum(n in index_set(numbers)) (numbers[n] * choices[n]) = 0; constraint count(choices, -1) + count(choices, 1) = 3; solve satisfy; Okay, one last one, a problem I saw last year at Chipy AlgoSIG. Basically they pick some leetcode problems and we all do them. I failed to solve this one: Given an array of integers heights representing the histogram's bar height where the width of each bar is 1, return the area of the largest rectangle in the histogram. The "proper" solution is a tricky thing involving tracking lots of bookkeeping states, which you can completely bypass by expressing it as constraints: array[int] of int: numbers = [2,1,5,6,2,3]; var 1..length(numbers): x; var 1..length(numbers): dx; var 1..: y; constraint x + dx <= length(numbers); constraint forall (i in x..(x+dx)) (y <= numbers[i]); var int: area = (dx+1)*y; solve maximize area; output ["(\(x)->\(x+dx))*\(y) = \(area)"] There's even a way to automatically visualize the solution (using vis_geost_2d), but I didn't feel like figuring it out in time for the newsletter. Is this better? Now if I actually brought these questions to an interview the interviewee could ruin my day by asking "what's the runtime complexity?" Constraint solvers runtimes are unpredictable and almost always than an ideal bespoke algorithm because they are more expressive, in what I refer to as the capability/tractability tradeoff. But even so, they'll do way better than a bad bespoke algorithm, and I'm not experienced enough in handwriting algorithms to consistently beat a solver. The real advantage of solvers, though, is how well they handle new constraints. Take the stock picking problem above. I can write an O(n²) algorithm in a few minutes and the O(n) algorithm if you give me some time to think. Now change the problem to Maximize the profit by buying and selling up to max_sales stocks, but you can only buy or sell one stock at a given time and you can only hold up to max_hold stocks at a time? That's a way harder problem to write even an inefficient algorithm for! While the constraint problem is only a tiny bit more complicated: include "globals.mzn"; int: max_sales = 3; int: max_hold = 2; array[int] of int: prices = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8]; array [1..max_sales] of var int: buy; array [1..max_sales] of var int: sell; array [index_set(prices)] of var 0..max_hold: stocks_held; var int: profit = sum(s in 1..max_sales) (prices[sell[s]] - prices[buy[s]]); constraint forall (s in 1..max_sales) (sell[s] > buy[s]); constraint profit > 0; constraint forall(i in index_set(prices)) (stocks_held[i] = (count(s in 1..max_sales) (buy[s] <= i) - count(s in 1..max_sales) (sell[s] <= i))); constraint alldifferent(buy ++ sell); solve maximize profit; output ["buy at \(buy)\n", "sell at \(sell)\n", "for \(profit)"]; Most constraint solving examples online are puzzles, like Sudoku or "SEND + MORE = MONEY". Solving leetcode problems would be a more interesting demonstration. And you get more interesting opportunities to teach optimizations, like symmetry breaking. Because my dad will email me if I don't explain this: "leetcode" is slang for "tricky algorithmic interview questions that have little-to-no relevance in the actual job you're interviewing for." It's from leetcode.com. ↩

3 hours ago 2 votes
ARM is great, ARM is terrible (and so is RISC-V)

I’ve long been interested in new and different platforms. I ran Debian on an Alpha back in the late 1990s and was part of the Alpha port team; then I helped bootstrap Debian on amd64. I’ve got somewhere around 8 Raspberry Pi devices in active use right now, and the free NNCPNET Internet email service … Continue reading ARM is great, ARM is terrible (and so is RISC-V) →

3 hours ago 2 votes
Stumbling upon

Something like a channel changer, for the web. That's what the idea was at first. But it led to a whole new path of discovery that even the site's creators couldn't have predicted. The post Stumbling upon appeared first on The History of the Web.

yesterday 7 votes
By the way, what are AA?
yesterday 6 votes