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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Takashi Kanemoto
April 17, 2019
Programming
500
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
390
30分でDoctrineの仕組みと使い方を完全にマスターする / phpconkagawa 2025 Doctrine
ttskch
5
1.7k
いりゃあせ、PHPカンファレンス名古屋2025 / Welcome to PHP Conference Nagoya 2025
ttskch
1
650
PHPとAPI Platformで作る本格的なWeb APIアプリケーション(入門編) / phpcon 2024 Intro to API Platform
ttskch
0
1.5k
今年書いた技術記事で伸びたやつの自慢と自分の中では力作なのにさっぱり伸びなかったやつの供養 / My Tech Articles 2024
ttskch
2
250
FigmaとPHPで作る1ミリたりとも表示崩れしない最強の帳票印刷ソリューション
ttskch
48
45k
データベース/SQL超入門!完全初心者向けに世界一分かりやすく解説します
ttskch
2
9k
Symfony UX Autocompleteとかいう 顧客が本当に必要だったもの
ttskch
0
2.4k
就活生あるいは新人エンジニアさんへのお節介なアドバイス
ttskch
0
1.7k
Other Decks in Programming
See All in Programming
エージェントを使い続けるためのメタワーク / Meta-work for keeping using the agent
rkaga
6
2.2k
社内AIエージェント「Askワンバン」における コストチューニングの取り組み
t0yohei
0
150
オーケストレーション記述言語 Katari
yukikurage
0
220
AI駆動開発4年目の現在地(『あなたはFDEになるべきか?』イベント資料)
kumaiu
0
130
Python Lambdaにおけるテストしやすい設計とAI支援の活用 / Designing Testable Python Lambda Functions with AI
kitano_yuichi
1
290
AI時代のシニアエンジニアとは
yosuke_furukawa
PRO
14
11k
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Kaigi on Rails 2026, Tokyo, Japan
marcoroth
2
400
React Native에 현대적인 빌드 도구 더하기: Rollipop 구현기
leegeunhyeok
0
180
AI-Powered Domain-Driven Design
ziobrando
0
380
當我們開始不讀 Code - AI Agent 時代,Code Review 與 Clean Code 還剩下什麼?
jame2408
1
360
Web3Dライブラリを作ってVue Custom Rendererの仕組みを理解しよう / lets learn vue custom renderer by making 3d library
drumath2237
1
120
Materialが消えた日 〜真っ白なFlutterキャンバスにRenderObjectで絵を描く〜
umigishiaoi
0
140
Featured
See All Featured
The Pragmatic Product Professional
lauravandoore
37
7.5k
Darren the Foodie - Storyboard
khoart
PRO
4
4.1k
Design in an AI World
tapps
1
380
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
350
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.7k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
620
Un-Boring Meetings
codingconduct
0
490
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
460
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
610
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
33
5.6k
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.3k
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!ʗ