牛客347614775号
牛客347614775号
全部文章
题解
归档
标签
去牛客网
登录
/
注册
牛客347614775号的博客
全部文章
/ 题解
(共18篇)
题解 | #字符串的排列#
//substring 用于字符串....charAt(i)用于字符串索引 //n!递归找出口的方法是,递归函数同时传递res。当满足结束条件就push进res function Permutation(str) { // write code here if(str=="")ret...
Javascript Node
2022-01-07
0
421
题解 | #二叉搜索树的最近公共祖先#
* function TreeNode(x) { * this.val = x; * this.left = null; * this.right = null; * } */ //发现找数字大小规律太乱了,那就找结构规律,反正也要按结构索引 function lowestCo...
Javascript Node
2022-01-06
0
456
题解 | #二叉搜索树的后序遍历序列#
//找到true的条件,即找到max界限 //正确的截取子树 //正确判断true出口 function VerifySquenceOfBST(sequence) { // write code here if(sequence.length==0){return false} ...
Javascript Node
2022-01-03
1
378
题解 | #从上往下打印二叉树#
this.val = x; this.left = null; this.right = null; } */ //不明白自己为什么在广度优先卡了十分钟,需要多重复练习! //重构二叉树的题,有时需要new TreeNode function PrintFromTopToBottom...
Javascript Node
2022-01-03
0
394
题解 | #删除链表中重复的结点#
function deleteDuplication(pHead) { // write code here let p=pHead if(!pHead){ return null } let vaild=0 //如果开头遇见重复 ...
Javascript Node
2021-12-31
0
441
题解 | #不相邻最大子序列和#
function subsequence( n , array ) { // write code here let max=0 let res=new Array() for(let i=0;i<array.length;i++){ if(a...
Javascript Node
2021-12-31
0
487
题解 | #主持人调度#
//循环超时。则把问题拆分解决 function minmumNumberOfHost( n , startEnd ) { // write code here let star=[] let end=[] let host=0 for(let i=0;i&...
Javascript Node
2021-12-30
2
478
题解 | #扭蛋机#
var n=parseInt(line)//返回数字 var res=''; while(n>0){ if((n/2)>Math.floor(n/2)){ n=(n-1)/2; res='2'+res; } else{ ...
Javascript V8
2021-12-24
0
422
题解 | #连续子数组最大和(ACM版本)#
ACM版本 一定要用parseInt()或者+转化!!! var str1=readline() var arr=str1.split(' ') var dp=[] for(let i=0;i<arr.length;i++){ if(i==0){ let b=+arr[...
Javascript V8
2021-12-21
0
507
题解 | #按之字形顺序打印二叉树#
this.val = x; this.left = null; this.right = null; } */ function Print(pRoot) { // write code here let res=[] let d=0 let d1=0...
Javascript Node
2021-12-16
0
433
首页
上一页
1
2
下一页
末页