โจทย์เขียนโค้ด Swift

โจทย์ 225 ข้อที่แก้ได้ด้วย Swift ตั้งแต่ลูปแรกไปจนถึงกราฟ dynamic programming และแมชชีนเลิร์นนิง เขียนโค้ดในเบราว์เซอร์ รันการทดสอบได้ทันที และรับรีวิวจาก AI

ง่าย · 134 ปานกลาง · 67 ยาก · 24

ทักษะที่จะได้ฝึก: การนับแยกสตริงแยกหลักตัวเลขลิสต์ลิสต์ 2 มิติลูปสูตรเลขคณิตGradient descentPolymorphismการหารลงตัวการเรียงลำดับ
  • Python · C++ · C#
  • ทดสอบอัตโนมัติ
  • รีวิวโค้ดโดย AI
  • แนวทางจากชุมชน
226
โจทย์
123
วิธีแก้ที่แชร์
9
ภาษา

โจทย์ทั้งหมด

ค้นหาตามหัวข้อ ภาษา หรือระดับความยาก

225 โจทย์
ง่าย

เลขฟีโบนัชชี

คืนค่าเลขฟีโบนัชชีลำดับที่ n

คุณจะได้เรียนรู้ การวนซ้ำอัปเดตสองตัวแปร
BeginnerLoopsSequencesStudent-beginner
ง่าย

Average of Three

Average three whole numbers.

คุณจะได้เรียนรู้ เลขคณิตการหาร
BeginnerLearning-pathVariables
ง่าย

Rectangle Perimeter

Compute the perimeter of a rectangle from its sides.

คุณจะได้เรียนรู้ เลขคณิตค่าที่คืนกลับ
BeginnerLearning-pathVariables
ยาก

Minimum Network Connection Cost

Choose undirected links so that every vertex can reach every other vertex, with minimum total cost.

คุณจะได้เรียนรู้ อัลกอริทึมของ KruskalUnion-find
Disjoint-setsGraphsMinimum-spanning-tree
ยังไม่มีวิธีแก้
ง่าย

Pyramid Rows

Draw a right-aligned pyramid of # blocks.

คุณจะได้เรียนรู้ รูปแบบสตริงการเว้นวรรค
BeginnerLearning-pathNested-loopsPatterns
ปานกลาง

Island Perimeter

Measure the coastline of land cells in a grid.

คุณจะได้เรียนรู้ นับขอบตรวจเพื่อนบ้าน 4 ช่อง
AdvancedGridsHackathon
ยังไม่มีวิธีแก้
ปานกลาง

Shortest Weighted Routes

Find the minimum total route cost from city 1 to each city.

คุณจะได้เรียนรู้ อัลกอริทึมของ Dijkstraลบแบบหน่วงเวลา
GraphsPriority-queuesShortest-path
ยังไม่มีวิธีแก้
ปานกลาง

Tic-Tac-Toe Winner

Decide the result of a tic-tac-toe board.

คุณจะได้เรียนรู้ เงื่อนไขชนะแนวทแยง
BeginnerConditionsGridsLearning-path
ยาก

Trapping Rain Water

Compute how much rain water an elevation map holds.

คุณจะได้เรียนรู้ สองพอยน์เตอร์ค่ามากสุดแบบ prefix
AdvancedArraysCompetitive-programmingGreedy
ง่าย

Hollow Square

Draw the outline of a square with * characters.

คุณจะได้เรียนรู้ ตรวจขอบสร้างสตริง
BeginnerLearning-pathNested-loopsPatterns
ยาก

Mini Stack-Language Interpreter

Evaluate a small stack language.

คุณจะได้เรียนรู้ แยก tokenรันคำสั่ง
InterpretersParsingStacks
ยังไม่มีวิธีแก้
ปานกลาง

Recursive Palindrome

Check a palindrome recursively, ignoring case and punctuation.

คุณจะได้เรียนรู้ กรณีฐานทำความสะอาดสตริง
BeginnerLearning-pathRecursionStrings
ยาก

Count Inversions

Count the out-of-order pairs in a list.

คุณจะได้เรียนรู้ Merge sortแบ่งแยกและเอาชนะ
AdvancedCompetitive-programmingSorting
ยังไม่มีวิธีแก้
ง่าย

Min and Max Together

Find the smallest and largest value in one pass.

คุณจะได้เรียนรู้ ไล่รอบเดียวคืนหลายค่า
ArraysBeginnerFunctionsLearning-path
ยาก

Sliding Window Maximum

Report the maximum of every window of k numbers.

คุณจะได้เรียนรู้ Deque แบบทางเดียวหน้าต่างใน O(n)
AdvancedCompetitive-programmingSliding-window
ยังไม่มีวิธีแก้
ง่าย

เงินทอน: จำนวนน้อยสุดของเหรียญ

ทอนเงินโดยใช้เหรียญสหรัฐให้น้อยที่สุดเท่าที่จะเป็นไปได้

คุณจะได้เรียนรู้ อัลกอริทึมแบบละโมบการทอนเงิน
BeginnerGreedyStudent-beginnermath
ง่าย

หารครึ่งจนเหลือหนึ่ง

นับจำนวนครั้งที่ต้องหารครึ่งเพื่อให้ตัวเลขเหลือ 1

คุณจะได้เรียนรู้ ลูป whileการนับ
BeginnerLearning-pathLoops
ปานกลาง

การค้นหา A* บนตารางที่มีน้ำหนัก

หาเส้นทางที่ถูกที่สุดผ่านตารางค่าใช้จ่ายของภูมิประเทศด้วย A* อัลกอริทึมค้นหาที่อยู่เบื้องหลังการหาเส้นทางในเกมและหุ่นยนต์

คุณจะได้เรียนรู้ การค้นหา A*ฮิวริสติก
GraphsGridsShortest-pathai