一.     称号 并寻求最深的二元相似.给定的二进制树.求其最小深度. 最小深度是沿从根节点,到叶节点最短的路径. 二.     分析 当我看到这个题目时.我直接将最深二叉树的代码略微改了下,把max改成min.本以为应该没有问题,谁知道WA了两次,我静下来看了看.最终知道了,当遇到有结点为NULL时就得要结束了.所下面次再简单的题目也要静下来好好分析,不然会easy出错. /** * Definition for binary tree * struct TreeNode { * int v…
解决问题的方法=>现象-->原因-->方案-->方案的优缺点…
近日调试一Asp.net程序,出现了“访问 IIS 元数据库失败”的错误信息,最后经过搜索发现了解决问题的方法. 解决方法如下: 1.依次点击“开始”-“运行”. 2.在“运行”栏内输入 “C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i ”(不含引号),然后点“确定”按钮. 3.出现的cmd窗口中显示“开始安装ASP.NET XXX”等内容,等待这个窗口自动关闭. 好了,到这里一般问题就解决了,如果尚未解决请参…
Selenium私房菜系列10 -- 我遇到的问题及解决问题的方法…
Selenium私房菜系列10 -- 我遇到的问题及解决问题的方法…
problem: Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. 将1-3999的整数转换为罗马数字 thinking: (1) 对比举例 个位数举例 Ⅰ,1 ]Ⅱ.2] Ⅲ,3] Ⅳ,4 ]Ⅴ.5 ]Ⅵ,6]Ⅶ.7] Ⅷ,8 ]Ⅸ.9 ] 十位数举例 Ⅹ.10] Ⅺ,11 ]Ⅻ,12] XIII,13] XIV,14] XV,1…
Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy one and sell one share of the stock multiple times). Ho…
A message containing letters from A-Z is being encoded to numbers using the following mapping: 'A' -> 1 'B' -> 2 ... 'Z' -> 26 Given an encoded message containing digits, determine the total number of ways to decode it. For example,Given encoded…
原题链接:https://oj.leetcode.com/problems/sort-list/ 题目:空间复杂度为常数,时间复杂度为O(nlogn)的排序链表实现 方法一:第一想法是模拟数组的快速排序,参考了算法导论,于是思路被牵到了如何处理交换节点上,几经波折总算实现,不过提交的结果TLE. /** * Definition for partition method result value * */ class PartitionResult { ListNode head; ListNo…
[D1T1vigenerepassword] P1778vigenerepassword Accepted 标签:[显示标签] 描写叙述 16世纪法国外交家Blaise de Vigenère设计了一种多表password加密算法--Vigenèrepassword.Vigenèrepassword的加密解密算法简单易用,且破译难度比較高,曾在美国南北战争中为南军所广泛使用.  在password学中,我们称须要加密的信息为明文.用M表示:称加密后的信息为密文,用C表示:而密钥是一种參数.是将明…