Check the mathematics
A price rises by 20% and then falls by 20%. Is it back to its starting value? Show the calculation with a starting price of 100 and explain the general rule.
- General rule: (1 + p)(1 − p) = 1 − p², always a net loss
DeepSeek is an AI model family for maths, coding and step-by-step reasoning. Start chatting with DeepSeek V4.1 Flash for free, then sign up to save your chats and get DeepSeek V4 Pro on Pro.
DeepSeek is good at percentage puzzles, efficient algorithms and explaining engineering trade-offs. In our tests, DeepSeek V4 Flash showed why a 20% rise and 20% fall leaves a price at 96, wrote a linear-time first-unique-character function with Unicode tests, and explained when caching makes stock counts stale.
A price rises by 20% and then falls by 20%. Is it back to its starting value? Show the calculation with a starting price of 100 and explain the general rule.
Write a Python function that returns the first non-repeating character in a string. Discuss time complexity and include tests for an empty string and repeated Unicode characters.
def first_non_repeating(s: str) -> str | None:counts = Counter(s)for ch in s:if counts[ch] == 1:
Explain why caching can make an application faster but its results less fresh. Use a stock-count example and propose an invalidation strategy.
Check the mathematics
Answered November 4, 2026, shown unedited
A price rises by 20% and then falls by 20%. Is it back to its starting value? Show the calculation with a starting price of 100 and explain the general rule. Keep your answer under 180 words, with code where useful.
DeepSeek V4 Flash
No. Start at 100:
So it ends at 96, not 100.
General rule: increasing by (p%) then decreasing by (p%) multiplies by:
[ (1+p)(1-p)=1-p^2 ]
So there is always a net loss of (p^2%). Here, (20^2% = 4%), so (100 - 4 = 96).
start = 100
after_rise = start * 1.20
end = after_rise * 0.80
print(end) # 96.0
The order doesn’t matter either way: a fall then a rise also gives 96. Because percentages are applied to different bases, you don’t return to the starting value.
Write an algorithm
Answered November 4, 2026, shown unedited
Write a Python function that returns the first non-repeating character in a string. Discuss time complexity and include tests for an empty string and repeated Unicode characters. Keep your answer under 180 words, with code where useful.
DeepSeek V4 Flash
def first_non_repeating(s: str) -> str | None:
"""Return first character with count 1, or None if none."""
from collections import Counter
counts = Counter(s) # O(n)
for ch in s: # O(n)
if counts[ch] == 1:
return ch
return None
# Tests
print(first_non_repeating("")) # None
print(first_non_repeating("aéa")) # é
print(first_non_repeating("abca")) # b
print(first_non_repeating("unicode😀🔁😀")) # 🔁
Time complexity: O(n) – two passes over string, O(n) space for counting. Works with any Unicode characters.
Explain a trade-off
Answered November 4, 2026, shown unedited
Explain why caching can make an application faster but its results less fresh. Use a stock-count example and propose an invalidation strategy. Keep your answer under 180 words, with code where useful.
DeepSeek V4 Flash
Caching stores hot data in fast memory, so reads skip slow DB queries. But it trades freshness: the cached value can be stale until evicted.
Stock-count example: Cache says stock=10, but a sale just decremented the DB to 8. Until the cache updates or expires, customers see 10 and may oversell.
Invalidation strategy: Use write-through invalidation – update the DB, then delete/refresh the cache key atomically, with a short TTL as a safety net.
def sell(item_id, qty):
with db.transaction():
new_stock = db.decrement(item_id, qty)
cache.set(f"stock:{item_id}", new_stock, ttl=60) # refresh
This keeps cached counts nearly fresh, bounds staleness to the TTL if a cache update fails, and still reduces DB read load.
These examples come from DeepSeek V4 Flash because Pro requests failed during this test session. Its caching example refreshes the cache before the transaction commits, so a rollback could leave a wrong stock count cached. Three sample prompts tested live by Chandan Kumar on November 4, 2026. Answers are unedited and regenerated for every new model.
DeepSeek V4.1 Flash costs the least, from 1 Sparks per message. DeepSeek V4 Pro costs the most, from 5.
| Model | Speed | Reasoning | Context | Sparks | Plan | Est. messages a month on Pro |
|---|---|---|---|---|---|---|
| DeepSeek V4.1 Flash Latest | Fast | Basic | 1M | Sparks1+ | Free | ≈10,000 |
| DeepSeek V4 Pro | Standard | Advanced | 1M | Sparks5+ | Pro | ≈2,000 |
| DeepSeek V4 Flash | Fast | Basic | 262.1K | Sparks1+ | Free | ≈10,000 |
| DeepSeek V3.2 | Fast | Basic | 128K | Sparks1+ | Pro | ≈10,000 |
Sparks are per message and start at the amount shown. Monthly counts are estimates; longer chats and attached files use more.
Context window
The largest on Sparkian is 1.1M tokens. Attached files count toward it.
Sparks per message
Free to try every day.
Est. messages a month on Pro
$19 a month with 10,000 Sparks included.
DeepSeek V4.1 Flash is the newest DeepSeek model, released September 8, 2026. You can use all 4 versions on Sparkian.
Compare DeepSeek with Claude Haiku and Gemini
See how DeepSeek holds up against other models in one prompt.
One plan, 100+ models
No separate subscription per provider.
Research with sources
Web search and reading, cited.
Images and teams
Generate in chat, share projects.
100+ models from more than 20 AI providers, all on one plan.
Pricing, plans and which DeepSeek model to pick.
DeepSeek is a trademark of DeepSeek. Sparkian is not affiliated with or endorsed by model providers.
Your next question, first draft, or big idea. Start here.