Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
今日の"どう書く"問題のアルゴリズム例
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Takashi Kanemoto
April 17, 2019
Programming
490
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
今日の"どう書く"問題のアルゴリズム例
Nagoya.php #15 補足資料
https://nagoyaphp.connpass.com/event/120856/
Takashi Kanemoto
April 17, 2019
More Decks by Takashi Kanemoto
See All by Takashi Kanemoto
API Platformを活用したPHPによる本格的なWeb API開発 / api-platform-book-intro
ttskch
2
350
30分でDoctrineの仕組みと使い方を完全にマスターする / phpconkagawa 2025 Doctrine
ttskch
5
1.6k
いりゃあせ、PHPカンファレンス名古屋2025 / Welcome to PHP Conference Nagoya 2025
ttskch
1
620
PHPとAPI Platformで作る本格的なWeb APIアプリケーション(入門編) / phpcon 2024 Intro to API Platform
ttskch
0
1.4k
今年書いた技術記事で伸びたやつの自慢と自分の中では力作なのにさっぱり伸びなかったやつの供養 / My Tech Articles 2024
ttskch
2
240
FigmaとPHPで作る1ミリたりとも表示崩れしない最強の帳票印刷ソリューション
ttskch
48
45k
データベース/SQL超入門!完全初心者向けに世界一分かりやすく解説します
ttskch
2
8.8k
Symfony UX Autocompleteとかいう 顧客が本当に必要だったもの
ttskch
0
2.4k
就活生あるいは新人エンジニアさんへのお節介なアドバイス
ttskch
0
1.7k
Other Decks in Programming
See All in Programming
IBM Bob Dojo #1 仕様駆動開発入門
oniak3ibm
PRO
0
260
Streamlitで実現する自然言語データアプリ開発
ayumu_yamaguchi
1
320
20260914 AIエージェント時代のPlatform Engineering LLM基盤とプロダクトの責務境界線
kanfab1
7
2.2k
Omarchy Tokyo やると聞いて UMPC 買ってセットアップしてきた
mtsmfm
0
160
AGENTS.md Is Not Enough:Build Skills, Don't Download Them
lx_t
0
130
市販E-Readerを乗っ取れ 〜Embedded Swiftで電子ペーパーガジェットを制御する〜
trickart
0
220
AI が書く Go コードの品質を劇的に向上させる Linter: “declscope”
mpyw
0
420
AWS DevOps Agentで インシデント対応をAIに任せたい
honmarkhunt
7
3.2k
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
300
thread_parallel_with_free-threaded_Python_and_NumPy.pdf
riku_sakamoto
0
360
Intent as Code
shoppingjaws
6
1.1k
モジュールの視点からSwiftを読み解く #iosdc
s_shimotori
0
200
Featured
See All Featured
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
2k
Building a Scalable Design System with Sketch
lauravandoore
464
34k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
250
The Curse of the Amulet
leimatthew05
3
15k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
570
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
3
4.3k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
280
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
510
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
580
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
2
2.2k
Six Lessons from altMBA
skipperchong
29
4.5k
Transcript
ࠓͷ”Ͳ͏ॻ͘”ͷ ΞϧΰϦζϜྫ 2019/04/17 #nagoyaphp @ttskch
ʹ͍ͭͯ
͖ͨͭͪʢ໊͋ͩʣ • (ג)ΧϧςοτίϛϡχέʔγϣϯζCTO • WebΤϯδχΞྺ7ɺPHPྺ7 • #nagoyaphpʊ • #symfony_meetup
͖ͨͭͪʢ໊͋ͩʣ • ͓ख͍ͨ͠ຊʢ2015/12ʣ • Schooߨࢣʢ2018/04ʣ ʮGitHubΛͬͨσϓϩΠࣗಈԽ࣮ફʯ ʮجຊ͔Β͔ͬ͠ΓֶͿ Symfony2ೖʯ
ͨ ͭ ͖ ͪ twitter.com/ttskch ͋͞ɺ͋ͳͨࠓ͙͢ϑΥϩʔ͠Α͏!!! શແྉ ·͞ʹ໊ݴػ ਓੜͰେͳ͜ͱɺͯ͢ ͖͔ͨͭͪΒڭΘͬͨ
͖ͨͭͪΛϑΥϩʔͨ͠Β ࠊ௧͕࣏Γ·ͨ͠ 100% φϯτʂ ϑΥϩϫʔ͔Βͷࢧ࣋ 100% ͍ͯ͠Δ ͍ͯ͠ͳ͍ ϑΥϩϫʔ͞Μ100ਓʹฉ͖·ͨ͠ ͖ͨͭͪΛϑΥϩʔ͍ͯ͠Δʁ
ձࣾʹ͍ͭͯ
(ג)Χϧςοτίϛϡχέʔγϣϯζ https://quartet-communications.com
(ג)Χϧςοτίϛϡχέʔγϣϯζ https://www.google.co.jp/search?q=Χʔςϯ
(ג)Χϧςοτίϛϡχέʔγϣϯζ https://lisket.jp
We are hiring!ʢϚδͰʣ • PHPer/JSer ઈࢍେืूதʂʢϦϞʔτόΠτՄʣ • Symfony+Angular ͰɺWebࠂۀքΛ ϗϫΠτʹ͢ΔΈΛ࡞ͬͯ·͢
• ܦӦϏδϣϯʮੈքҰޮతͳཧళʯ
We are hiring!ʢϚδͰʣ • ࣗࣾαʔϏεʮLisketʯͰࣗࣾͷۀޮԽ • શࣾһͷฏۉۀ͕࣌ؒ5h/݄͙Β͍Ͱ͢ ಛผड
We are hiring!ʢϚδͰʣ ΤϯδχΞͷಇ͖͢͞େࣄʹͯ͠·͢✨
We are hiring!ʢϚδͰʣ ·͓͚ͣͩͰʂؾܰʹ͔͚͍ͯͩ͘͞
ࠓͷ”Ͳ͏ॻ͘”ͷ ΞϧΰϦζϜྫ 2019/04/17 #nagoyaphp @ttskch
http://nabetani.sakura.ne.jp/hena/ordf04octsp/
ͷٻΊํ
1 2 4 8 16 32 64 128
3 5 4 4
3 5 4 4 1 2 3 2
1 2 3 2 3 5 4 4 ؔͯͦ͠͏
3 5 4 4 1 2 3 2
3 5 4 4 1 2 3 2 3 -1
= 2
3 5 4 4 1 2 3 2 2 +
3 = 5 3 -1 = 2
3 5 4 4 1 2 3 2
3 5 4 4 1 2 3 2 2 -1
= 1
3 5 4 4 1 2 3 2 1 +
3 = 4 2 -1 = 1
3 5 4 4 ࣮ઢؒͷڑ͔ΒٻΊΒΕΔ
5
5 4
5 4 4 -1 = 3
5 4 3 + 3 = 6 4 -1 =
3
5 4 4 -1 = 3 3 + 3 =
6 3 + 2= 5
5 4 ڑ͕4ͷͱ͖͚ͩܭࢉํ๏͕มΘΔ
1 2 4 8 16 32 64 128
2 8 16 64 1 2 3 2 1 4
32 128
21 23 24 26 1 2 3 2 20 22
25 27
21 23 24 26 1 2 3 2 20 22
25 27
21 23 24 26 1 2 3 2 20 22
25 27 ൪߸Λ2ͷྦྷͰද͢ͱࢦ෦ͷࠩͰڑΛٻΊΒΕΔ
21 23 24 26 2 3 2 22 25 Ұप͢Δͱۙͮ͘ߏͳͷͰ8ͷ༨Λ͑Αͦ͞͏✋
1 20 27
ೖྗͷύʔε
1 2 4 8 16 32 64 128
2 8 16 64 165 Λ 1 + 4 +
32 + 128 ʹղ͍ͨ͠ 1 4 32 128
2 8 16 64 1 4 32 128
21 23 24 26 20 22 25 27
165 = 27x1 + 26x0 + 25x1 + 24x0 +
23x0 + 22x1 + 21x0 + 20x1 21 23 24 26 20 22 25 27
165 = b10100101 21 23 24 26 20 22 25
27
21 23 24 26 20 22 25 27 ೖྗΛ2ਐͰද͢ͱɺ͕1ͷܻ͕࣮ઢͷҐஔΛࣔ͢
࣮ྫ
public function run(string $input): string { $lines = array_values(array_filter(range(0, 7),
function (int $i) use ($input) { return str_split(sprintf('%b', $input))[$i] ?? false; })); $vertices = []; for ($i = 0; $i < count($lines); $i++) { $distance = ($lines[($i + 1) % count($lines)] - $lines[$i] + 8) % 8; $vertices[] = ($distance === 4 ? 2 : 3) + $distance - 1; } sort($vertices); return implode('', $vertices); }
public function run(string $input): string { $lines = array_values(array_filter(range(0, 7),
function (int $i) use ($input) { return str_split(sprintf('%b', $input))[$i] ?? false; })); $vertices = []; for ($i = 0; $i < count($lines); $i++) { $distance = ($lines[($i + 1) % count($lines)] - $lines[$i] + 8) % 8; $vertices[] = ($distance === 4 ? 2 : 3) + $distance - 1; } sort($vertices); return implode('', $vertices); } ೖྗΛ2ਐʹมͯ͠ɺཱ͍ͬͯΔϏοτͷҐஔʢ0ʙ7ʣΛྻʹ͢Δɻ ྫͷ߹ $lines === [0, 2, 5, 7] ͱͳΔɻ͜Ε͕࣮ઢͷҐஔɻ ೖྗͷύʔε
public function run(string $input): string { $lines = array_values(array_filter(range(0, 7),
function (int $i) use ($input) { return str_split(sprintf('%b', $input))[$i] ?? false; })); $vertices = []; for ($i = 0; $i < count($lines); $i++) { $distance = ($lines[($i + 1) % count($lines)] - $lines[$i] + 8) % 8; $vertices[] = ($distance === 4 ? 2 : 3) + $distance - 1; } sort($vertices); return implode('', $vertices); } [0, 2, 5, 7] ͱ͍͏ྻʹରͯ͠ɺཁૉؒͷ͔ࠩΒ࣮ઢؒͷڑΛٻΊΔͱɺ (2-0+8)%8=2, (5-2+8)%8=3, (7-5+8)%8=2, (0-7+8)%8=1 ͱͳΔɻ ڑ͕4ͷ߹ 2+ڑ-1 ͕ɺڑ͕ͦΕҎ֎ͷ߹ 3+ڑ-1 ͕ɻ ͷܭࢉ
https://github.com/ ttskch/nagoyaphp15
@ttskch ʘThanks!ʗ