今日已更新 233 条资讯 | 累计 32270 条内容
关于我们

今日精选

HOT

最新资讯

共 32270 篇
第 1181/1614 页
AI 资讯 Dev.to

Weekly Challenge: Existence

Weekly Challenge 377 Each week Mohammad S. Anwar sends out The Weekly Challenge , a chance for all of us to come up with solutions to two weekly tasks. My solutions are written in Python first, and then converted to Perl. Unless otherwise stated, Copilot (and other AI tools) have NOT been used to generate the solution. It's a great way for us all to practice some coding. Challenge , My solutions Task 1: Reverse Existence Task You are given a string. Write a script to find whether any substring of length 2 is also present in the reverse of the given string. My solution This is relatively straight forward. I create a variable reversed_string which is the string reversed. I then have a loop called start_pos that goes from 0 to 2 less than the length of the string. At each position, I check if the two letters at that position are in the original string. def reverse_existence ( input_string : str ) -> bool : reversed_string = input_string [:: - 1 ] for start_pos in range ( len ( input_string ) - 1 ): if reversed_string [ start_pos : start_pos + 2 ] in input_string : return True return False The Perl solution follows the same logic. sub main ($input_string) { my $reversed_string = reverse ( $input_string ); foreach my $start_pos ( 0 .. length ( $input_string ) - 2 ) { if ( index ( $input_string , substr ( $reversed_string , $start_pos , 2 ) ) != - 1 ) { say " true "; return ; } } say " false "; } Examples $ ./ch-1.py abcba true $ ./ch-1.py racecar true $ ./ch-1.py abcd false $ ./ch-1.py banana true $ ./ch-1.py hello true Task 2: Prefix Suffix Task You are given an array of strings. Write a script to find if the two strings ( str1 , str2 ) in the given array such that str1 is prefix and suffix of str2. Return the total count of such pairs. My solution In Python, this is a one line solution. I use the combinations function from the itertools module to produce all combinations of pairs of str1 and str2 . For each pair, I use the startwith and endswith function on the strings

Simon Green 2026-06-14 20:28 8 原文
AI 资讯 The Verge AI

Solid-state batteries still aren’t ready, but gels are

This is The Stepback, a weekly newsletter breaking down one essential story from the tech world. For more on e-bikes, power stations, and how to work anywhere, follow Thomas Ricker. The Stepback arrives in our subscribers' inboxes at 8AM ET. Opt in for The Stepback here. How it started Lithium-ion batteries are everywhere as we […]

Thomas Ricker 2026-06-14 20:00 9 原文
AI 资讯 HackerNews

Show HN: Capacitor Alarm Clock

I made an alarm clock that blows up capacitors to wake you up. There are more details on the Github repo but it's made from an esp32-c3 as the microcontroller, with 3 capacitor slots. There are relays on each capacitor slot to put 15v reverse voltage on the capacitor, with 5.1 ohm resistors on each slot for current limiting in case the capacitor shorts out. I also chucked in an SSD1315 OLED to show the time and a menu to configure it, although there's a web UI as well. The esp32 also means you c

arcaege 2026-06-14 19:19 4 原文
AI 资讯 Dev.to

The Aetheris Breakthrough (2036–2037): The SWIFT Collapse and the Subsea Qubit War

[Excerpted from THE QUANTUM COLLAPSE CHRONICLES — not science fiction, but a grounded forecast of what may come when quantum computation dismantles the cryptographic foundations of our digital civilization. These articles explore the collapse of computational trust and the brutal reconstruction of the world that follows.] The history of human civilization is often defined by sudden, violent shifts in the nature of power. We speak of the fall of empires, the industrial revolutions, and the splitting of the atom. But in the mid-2030s, the world experienced a collapse that was not made of steel or stone, but of mathematics. It was a quiet, clinical, and utterly devastating unraveling of the digital fabric that held modern society together. To understand The Quantum Collapse , one must look past the headlines of the era and into the humming, sub-Kelvin depths of the dilution refrigerators that changed everything. This is the story of how the transition from probabilistic experimentation to deterministic computation rendered the world's secrets transparent and its economies obsolete. The Death of Noise: The Rise of Dr. Aris Thorne For the first three decades of the 21st century, quantum computing was a game of chance. Scientists operated in the era of Noisy Intermediate-Scale Quantum (NISQ) devices—machines so temperamental and prone to error that every calculation was a desperate struggle against environmental noise. In those days, a single stray photon or a microscopic fluctuation in temperature could collapse a delicate superposition, turning a groundbreaking calculation into useless digital static. The turning point arrived in 2036 at the Institute for Advanced Quantum Engineering (IAQE) in the High Sierras. The air in the facility didn't vibrate with the erratic drone of the late 2020s; instead, it carried a heavy, rhythmic thrum—the sonic signature of the Lattice-Array-9 (LA-9). At the center of this revolution was Dr. Aris Thorne, the lead architect of the LA-9 pr

Bios and History 2026-06-14 18:00 11 原文