当前位置: 首页 > news >正文

网站建设的具体过程如何自己开网站

网站建设的具体过程,如何自己开网站,新乡做网站的多吗,企业网站建设背景417. 太平洋大西洋水流问题 水往高处流&#xff0c;先记录两个海祥往高处流所能留到的地址&#xff0c;之后将他们的合并区域进行输出 static const int dirs[4][2] {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};class Solution { public:vector<vector<int>> heights;v…

417. 太平洋大西洋水流问题

水往高处流,先记录两个海祥往高处流所能留到的地址,之后将他们的合并区域进行输出

static const int dirs[4][2] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};class Solution {
public:vector<vector<int>> heights;void dfs(int row, int col, vector<vector<bool>> & ocean) {int m = ocean.size();int n = ocean[0].size();if (ocean[row][col]) {return;}ocean[row][col] = true;for (int i = 0; i < 4; i++) {int newRow = row + dirs[i][0], newCol = col + dirs[i][1];if (newRow >= 0 && newRow < m && newCol >= 0 && newCol < n && heights[newRow][newCol] >= heights[row][col]) {dfs(newRow, newCol, ocean);}}}vector<vector<int>> pacificAtlantic(vector<vector<int>>& heights) {this->heights = heights;int m = heights.size();int n = heights[0].size();vector<vector<bool>> pacific(m, vector<bool>(n, false));vector<vector<bool>> atlantic(m, vector<bool>(n, false));for (int i = 0; i < m; i++) {dfs(i, 0, pacific);}for (int j = 1; j < n; j++) {dfs(0, j, pacific);}for (int i = 0; i < m; i++) {dfs(i, n - 1, atlantic);}for (int j = 0; j < n - 1; j++) {dfs(m - 1, j, atlantic);}vector<vector<int>> result;for (int i = 0; i < m; i++) {for (int j = 0; j < n; j++) {if (pacific[i][j] && atlantic[i][j]) {result.push_back({i,j});}}}return result;}
};

24. 两两交换链表中的节点

在纸上画一画

class Solution {
public:ListNode* swapPairs(ListNode* head) {ListNode*_head=new ListNode(0);_head->next=head;ListNode*cur=_head;while(cur->next!=nullptr&&cur->next->next!=nullptr){ListNode*tmp=cur->next->next->next;ListNode*tmp1=cur->next->next;cur->next->next->next=cur->next;cur->next->next=tmp;cur->next=tmp1;cur=cur->next->next;}return _head->next;}
};

19.删除链表的倒数第N个节点

class Solution {
public:ListNode* removeNthFromEnd(ListNode* head, int n) {ListNode*_head=new ListNode(0);_head->next=head;ListNode*cur=_head;int size=0;while(cur->next!=nullptr){cur=cur->next;size++;}size=size-n;cur=_head;while(size--){cur=cur->next;}cur->next=cur->next->next;return _head->next;}
};

还有另外一种写法,双指针快慢,先让快指针走n,然后再让慢指针和快指针一起走,当快指针为null的时候删除慢指针,返回头节点

class Solution {
public:ListNode* removeNthFromEnd(ListNode* head, int n) {ListNode* dummyHead = new ListNode(0);dummyHead->next = head;ListNode* slow = dummyHead;ListNode* fast = dummyHead;while(n-- && fast != NULL) {fast = fast->next;}fast = fast->next; // fast再提前走一步,因为需要让slow指向删除节点的上一个节点while (fast != NULL) {fast = fast->next;slow = slow->next;}slow->next = slow->next->next; // ListNode *tmp = slow->next;  C++释放内存的逻辑// slow->next = tmp->next;// delete nth;return dummyHead->next;}
};

面试题 02.07. 链表相交

很有意思的解法,正常的解法应该是先都过一遍,然后看大家的尺寸
然后,把双方指针移到短指针开始的位置开始比较,相等返回,不相等噶

class Solution {
public:ListNode *getIntersectionNode(ListNode *headA, ListNode *headB) {if (headA == nullptr || headB == nullptr) {return nullptr;}ListNode *pA = headA, *pB = headB;while (pA != pB) {pA = pA == nullptr ? headB : pA->next;pB = pB == nullptr ? headA : pB->next;}return pA;}
};
http://www.hkea.cn/news/511762/

相关文章:

  • 招标网站怎么做吴江seo网站优化软件
  • 苏州建设工程协会网站seo去哪里学
  • 上海正规网站制作价格可口可乐软文营销案例
  • 番禺网站 建设信科网络站长之家ping
  • 建筑工程施工承包合同关键词优化报价推荐
  • 网站可以免费看企业网站系统
  • 中华人民共和国建设部网站seo怎么快速提高排名
  • 南宁做网站的有几家东莞网络营销网站建设
  • 苏州知名网站建设开发新区seo整站优化公司
  • 政府建设网站计划书品牌营销策略包括哪些内容
  • 深圳市做网站百度seo排名点击器app
  • 五莲网站建设维护推广网络营销推广及优化方案
  • 重庆网红整站多关键词优化
  • 动易网站cms一级消防工程师考试
  • wordpress更新报错想找搜索引擎优化
  • 提供网站建设费用资源网
  • wordpress怎么使用主题seo优化评论
  • 柳州做网站如何建网站详细步骤
  • 黄岛做网站哪家好四川seo关键词工具
  • dede门户网站模版写软文推广
  • 网站开发者排名开发一个app平台大概需要多少钱?
  • 做网站 博客百度推广助手客户端
  • 温州市手机网站制作哪家好爱站网长尾词挖掘
  • 党委网站建设要求凡科建站靠谱吗
  • wordpress 安卓客户端福建seo优化
  • 襄阳seo技术长沙seo网站优化
  • 做一的同志小说网站做seo要投入什么
  • 网站的文件结构百度搜索排名怎么收费
  • 全景网站app网络营销工具分析
  • 南京建设工程交易中心网站seo是什么的简称