上一页 1 ··· 23 24 25 26 27 28 29 30 31 ··· 46 下一页
摘要: 1.小程序生命周期 App.js中 App({ onLaunch() { //生命周期回调——监听小程序初始化。全局只触发一次 }, onShow(){ //生命周期回调——监听小程序启动或切前台。 }, onHide(){ //生命周期回调——监听小程序切后台。 }, onError(msg){ 阅读全文
posted @ 2022-10-06 18:00 lwx_R 阅读(99) 评论(0) 推荐(0)
摘要: slow 一次走一步,fast 一次走两步。 那么当 fast 到达链表的末尾时,slow 必然位于中间。 ListNode* middleNode(ListNode* head) { ListNode* slow = head; ListNode* fast = head; while (fast 阅读全文
posted @ 2022-10-06 11:59 lwx_R 阅读(30) 评论(0) 推荐(0)
摘要: ListNode* mergeTwoLists(ListNode* l1, ListNode* l2) { if(l1 == NULL){ if(l2 == NULL){ return NULL; }else{ return l2; } } if(l1 != NULL && l2 == NULL){ 阅读全文
posted @ 2022-10-06 11:47 lwx_R 阅读(13) 评论(0) 推荐(0)
摘要: ListNode* reverseList(ListNode* head) { ListNode* tail=NULL; ListNode* front=head; ListNode* curr=NULL; //先令curr指向front,front移动下一个,curr的next指向tail实现反转 阅读全文
posted @ 2022-10-06 11:47 lwx_R 阅读(18) 评论(0) 推荐(0)
摘要: ListNode* getKthFromEnd(ListNode* head, int k) { ListNode* fast=head; ListNode* slow=head; //因为头结点开始 所以要从1开始 for(int i=1;i<k;i++){ fast=fast->next; // 阅读全文
posted @ 2022-10-06 11:45 lwx_R 阅读(27) 评论(0) 推荐(0)
摘要: ListNode* deleteNode(ListNode* head, int val) { if(head->val == val){ head=head->next; return head; } ListNode* front=head->next; ListNode* tail=head; 阅读全文
posted @ 2022-10-06 11:44 lwx_R 阅读(57) 评论(0) 推荐(0)
摘要: 1.数据绑定 WXML中部分数据来自JS中的data 1.1 js中设置数据 data: { myName:"123", title:"weixin", content:"123000", arr:["str","lwx"],//数组 // 对象 obj:{name:"lwx",age:18}, d 阅读全文
posted @ 2022-10-05 18:31 lwx_R 阅读(89) 评论(0) 推荐(0)
摘要: 1.新建component 2.使用 2.1 在json中加入 "usingComponents": { "comp":"/components/comp/comp" } 2.2 html使用 <comp></comp> 3.自定义属性值 3.1 在自定义组件的js中 /** * 组件的属性列表 * 阅读全文
posted @ 2022-10-04 20:07 lwx_R 阅读(18) 评论(0) 推荐(0)
摘要: 1.bfs没法回溯,会出现应该能到达的位置被访问 2.多起点 struct pp{ int x; int y; int step; int vis[10][10]; }; int dx[4]={0,0,1,-1}; int dy[4]={1,-1,0,0}; int m; int n; int vi 阅读全文
posted @ 2022-10-04 19:32 lwx_R 阅读(44) 评论(0) 推荐(0)
摘要: 由小至大推导公式,从2段开始一直到n段 int cuttingRope(int n) { //dp[i-j]*j 分为多段 //i-j *j 分为俩端 int dp[n+1]; memset(dp,0,sizeof(dp)); dp[2]=1; for(int i=3;i<=n;i++){ cout 阅读全文
posted @ 2022-10-04 19:21 lwx_R 阅读(25) 评论(0) 推荐(0)
上一页 1 ··· 23 24 25 26 27 28 29 30 31 ··· 46 下一页