<div class="directories"> <!-- Generate directories listing --> <!-- Generate posts listing --> <div class="post-preview"> <a href="/skill/coding/php-foreach-object.html"> <h2 class="post-title"> PHP - Foreach Object </h2> <sub>-「Skill / Coding」</sub> <div class="post-content-preview"> 题目描述 使对象可以像数组一样进行 foreach 循环 要求属性必须是私有属性 代码实现 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52... </div> </a> <p class="post-meta"> Posted by Oscaner on October 21, 2018 </p> </div> <div class="post-preview"> <a href="/skill/coding/two-sum.html"> <h2 class="post-title"> LeetCode - 两数之和 </h2> <sub>-「Skill / Coding」</sub> <div class="post-content-preview"> 题目描述 给定一个整数数组和一个目标值, 找出数组中和为目标值的两个数。 你可以假设每个输入只对应一种答案, 且同样的元素不能被重复利用。 示例: 给定 nums = [2, 7, 11, 15], target = 9 因为 nums[0] + nums[1] = 2 + 7 = 9 所以返回 [0, 1] 代码实现(C语言) 1. 暴力法 1 2 3 4 5 6 7 ... </div> </a> <p class="post-meta"> Posted by Oscaner on October 21, 2018 </p> </div> <div class="post-preview"> <a href="/skill/coding/php-bubble-sort.html"> <h2 class="post-title"> PHP - Bubble Sort </h2> <sub>-「Skill / Coding」</sub> <div class="post-content-preview"> 问题描述 用 PHP 实现起泡排序 给定:$array = [100, 5, 25, 29, 11, 65, 33, 22, 68, 19]; 结果:$array = [5, 11, 19, 22, 25, 29, 33, 65, 68, 100]; 代码实现 该算法详解请看:《C++ 数据结构 (二) 向量 (7) 起泡排序》 1 2 3 4 5 6 7 8 9 10 11 ... </div> </a> <p class="post-meta"> Posted by Oscaner on November 19, 2018 </p> </div> <div class="post-preview"> <a href="/skill/coding/php-two-max.html"> <h2 class="post-title"> PHP - Search Two Max </h2> <sub>-「Skill / Coding」</sub> <div class="post-content-preview"> 问题描述 找出数组中最大的两个数的下标, 用 x1、x2 存储, 且 A[x1] &gt;= A[x2] 要求: 递归算法 给定: $A = [10, 30, 400, 50, 10, 1000, 200, 60, 20, 10]; 结果: 1 2 A[x1] = A[5] = 1000 A[x2] = A[2] = 400 代码实现 该算法详解请看: 《C语言数据结构... </div> </a> <p class="post-meta"> Posted by Oscaner on November 21, 2018 </p> </div> <div class="post-preview"> <a href="/skill/coding/php-fibonacci-sequence.html"> <h2 class="post-title"> PHP - Fibonacci Sequence </h2> <sub>-「Skill / Coding」</sub> <div class="post-content-preview"> 问题描述 请编写斐波那契数列算法 输入:5 输出: 1 2 3 4 5 6 0 =&gt; 0 1 =&gt; 1 2 =&gt; 1 3 =&gt; 2 4 =&gt; 3 5 =&gt; 5 代码实现 该算法详解请看: 《C语言数据结构 (一) 绪论 (6) 动态规划 (1)》 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 &lt... </div> </a> <p class="post-meta"> Posted by Oscaner on November 21, 2018 </p> </div> <div class="post-preview"> <a href="/skill/coding/php-lcs.html"> <h2 class="post-title"> PHP - LCS </h2> <sub>-「Skill / Coding」</sub> <div class="post-content-preview"> 问题描述 给定两个字符串, 求解这两个字符串的最长公共子序列 (Longest Common Sequence) 如 str1: advantage;str2: didactical 则这两个字符串的最长公共子序列长度为 4, 最长公共子序列是: data 代码实现 该算法详解请看: 《C语言数据结构 (一) 绪论 (6) 动态规划 (2)》 1 2 3 4 5 6 7 8 9... </div> </a> <p class="post-meta"> Posted by Oscaner on November 22, 2018 </p> </div> <div class="post-preview"> <a href="/skill/coding/php-binary-search.html"> <h2 class="post-title"> PHP - Binary Search </h2> <sub>-「Skill / Coding」</sub> <div class="post-content-preview"> 问题描述 用 PHP 实现二分查找 要求: 返回不大于所查询元素的最后一个元素的下标 给定: $A = [1, 3, 5, 8, 13, 19, 20, 31, 43, 50]; 查询 8,结果返回: 3 查询 0,结果返回: -1 查询 100,结果返回: 9 代码实现 该算法详解请看: 《C++ 数据结构(二)向量(5)二分查找》 1 2 3 4 5 6 7 8 9 10... </div> </a> <p class="post-meta"> Posted by Oscaner on November 25, 2018 </p> </div> <div class="post-preview"> <a href="/skill/coding/php-fibonacci-search.html"> <h2 class="post-title"> PHP - Fibonacci Search </h2> <sub>-「Skill / Coding」</sub> <div class="post-content-preview"> 问题描述 用 PHP 编写斐波那契查找 要求: 查询失败返回 -1; 查询成功返回下标 给定: $A = [1, 3, 5, 8, 13, 19, 20, 31, 43, 50]; 查询 8,结果返回: 3 代码实现 该算法详解请看: 《C++ 数据结构 (二) 向量 (6) 斐波那契查找》 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ... </div> </a> <p class="post-meta"> Posted by Oscaner on November 25, 2018 </p> </div> <div class="post-preview"> <a href="/skill/coding/php-merge-sort.html"> <h2 class="post-title"> PHP - Merge Sort </h2> <sub>-「Skill / Coding」</sub> <div class="post-content-preview"> 问题描述 用 PHP 实现归并排序 给定: $array = [100, 5, 25, 29, 11, 65, 33, 22, 68, 19]; 结果: $array = [5, 11, 19, 22, 25, 29, 33, 65, 68, 100]; 代码实现 该算法详解请看: 《C++ 数据结构 (二) 向量 (8) 归并排序》 1 2 3 4 5 6 7 8 9 10 ... </div> </a> <p class="post-meta"> Posted by Oscaner on November 28, 2018 </p> </div> <div class="post-preview"> <a href="/skill/coding/php-selection-sort.html"> <h2 class="post-title"> PHP - Selection Sort </h2> <sub>-「Skill / Coding」</sub> <div class="post-content-preview"> 问题描述 用 PHP 实现选择排序 给定:$array = [100, 5, 25, 29, 11, 65, 33, 22, 68, 19]; 结果:$array = [5, 11, 19, 22, 25, 29, 33, 65, 68, 100]; 代码实现 该算法详解请看: 《C++ 数据结构 (三) 列表 (3) 选择排序》 1 2 3 4 5 6 7 8 9 10 11... </div> </a> <p class="post-meta"> Posted by Oscaner on December 1, 2018 </p> </div> <div class="post-preview"> <a href="/skill/coding/php-binary-conversion.html"> <h2 class="post-title"> PHP - Binary Conversion </h2> <sub>-「Skill / Coding」</sub> <div class="post-content-preview"> 问题描述 用 PHP 实现进制转换 输入: 十进制数 输出: 根据自定义进制(1 &lt; 进制 &lt;= 16)输出相应结果 代码实现 该算法详解请看: C++ 数据结构 (四) 栈与队列 (2) 栈应用 (1) 进制转换 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 &lt;?php funct... </div> </a> <p class="post-meta"> Posted by Oscaner on December 3, 2018 </p> </div> </div>