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

网站建设调研报告的前言网址查询工具

网站建设调研报告的前言,网址查询工具,厦门房产网,网站建设竞标ppt代码随想录算法训练营第42期 第六天 | LeetCode242.有效的字母异位词、349. 两个数组的交集、202. 快乐数、1. 两数之和 一、242.有效的字母异位词 解题代码C: bool isAnagram(char* s, char* t) {int len1 strlen(s);int len2 strlen(t);int al[26] {0};int b…

代码随想录算法训练营第42期 第六天 | LeetCode242.有效的字母异位词、349. 两个数组的交集、202. 快乐数、1. 两数之和


一、242.有效的字母异位词

解题代码C:

bool isAnagram(char* s, char* t) {int len1 = strlen(s);int len2 = strlen(t);int al[26] = {0};int bl[26] = {0};for(int i = 0; i < len1; i ++)al[s[i] - 'a'] ++;for(int i = 0; i < len2; i ++)bl[t[i] - 'a'] ++;for(int i = 0; i < 26; i ++)if(al[i] != bl[i])return false;return true;
}

题目链接/文章讲解/视频讲解:
https://programmercarl.com/0242.%E6%9C%89%E6%95%88%E7%9A%84%E5%AD%97%E6%AF%8D%E5%BC%82%E4%BD%8D%E8%AF%8D.html



二、349. 两个数组的交集

解题代码C:

int* intersection1(int* nums1, int nums1Size, int* nums2, int nums2Size, int* returnSize){int nums1Cnt[1000] = {0};int lessSize = nums1Size < nums2Size ? nums1Size : nums2Size;int * result = (int *) calloc(lessSize, sizeof(int));int resultIndex = 0;int* tempNums;int i;/* Calculate the number's counts for nums1 array */for(i = 0; i < nums1Size; i ++) {nums1Cnt[nums1[i]]++;}/* Check if the value in nums2 is existing in nums1 count array */for(i = 0; i < nums2Size; i ++) {if(nums1Cnt[nums2[i]] > 0) {result[resultIndex] = nums2[i];resultIndex ++;/* Clear this count to avoid duplicated value */nums1Cnt[nums2[i]] = 0;}}* returnSize = resultIndex;return result;
}

题目链接/文章讲解/视频讲解:
https://programmercarl.com/0349.%E4%B8%A4%E4%B8%AA%E6%95%B0%E7%BB%84%E7%9A%84%E4%BA%A4%E9%9B%86.html



三、202. 快乐数

解题代码C:

int get_sum(int n) {int sum = 0;div_t n_div = { .quot = n };while (n_div.quot != 0) {n_div = div(n_div.quot, 10);sum += n_div.rem * n_div.rem;}return sum;
}// (版本1)使用数组
bool isHappy(int n) {// sum = a1^2 + a2^2 + ... ak^2// first round:// 1 <= k <= 10// 1 <= sum <= 1 + 81 * 9 = 730// second round:// 1 <= k <= 3// 1 <= sum <= 36 + 81 * 2 = 198// third round:// 1 <= sum <= 81 * 2 = 162// fourth round:// 1 <= sum <= 81 * 2 = 162uint8_t visited[163] = { 0 };int sum = get_sum(get_sum(n));int next_n = sum;while (next_n != 1) {sum = get_sum(next_n);if (visited[sum]) return false;visited[sum] = 1;next_n = sum;};return true;
}// (版本2)使用快慢指针
bool isHappy(int n) {int slow = n;int fast = n;do {slow = get_sum(slow);fast = get_sum(get_sum(fast));} while (slow != fast);return (fast == 1);
}

题目链接/文章讲解/视频讲解:
https://programmercarl.com/0202.%E5%BF%AB%E4%B9%90%E6%95%B0.html



四、1. 两数之和

解题代码C:

/*** Note: The returned array must be malloced, assume caller calls free().*/// leetcode 支持 ut_hash 函式庫typedef struct {int key;int value;UT_hash_handle hh; // make this structure hashable} map;map* hashMap = NULL;void hashMapAdd(int key, int value){map* s;// key already in the hash?HASH_FIND_INT(hashMap, &key, s);if(s == NULL){s = (map*)malloc(sizeof(map));s -> key = key;HASH_ADD_INT(hashMap, key, s);}s -> value = value;}map* hashMapFind(int key){map* s;// *s: output pointerHASH_FIND_INT(hashMap, &key, s);   return s;}void hashMapCleanup(){map* cur, *tmp;HASH_ITER(hh, hashMap, cur, tmp){HASH_DEL(hashMap, cur);free(cur);}}void hashPrint(){map* s;for(s = hashMap; s != NULL; s=(map*)(s -> hh.next)){printf("key %d, value %d\n", s -> key, s -> value);}}int* twoSum(int* nums, int numsSize, int target, int* returnSize){int i, *ans;// hash find resultmap* hashMapRes; hashMap = NULL;ans = malloc(sizeof(int) * 2);for(i = 0; i < numsSize; i++){// key 代表 nums[i] 的值,value 代表所在 index;hashMapAdd(nums[i], i);}hashPrint();for(i = 0; i < numsSize; i++){hashMapRes = hashMapFind(target - nums[i]);if(hashMapRes && hashMapRes -> value != i){ans[0] = i;ans[1] = hashMapRes -> value ;*returnSize = 2;return ans;}}hashMapCleanup();return NULL;
}

题目链接/文章讲解/视频讲解:
https://programmercarl.com/0001.%E4%B8%A4%E6%95%B0%E4%B9%8B%E5%92%8C.html


文章转载自:
http://anomie.qkxt.cn
http://flabellifoliate.qkxt.cn
http://repudiate.qkxt.cn
http://persuade.qkxt.cn
http://hydrogasification.qkxt.cn
http://allegretto.qkxt.cn
http://flagrant.qkxt.cn
http://squeaky.qkxt.cn
http://favorably.qkxt.cn
http://kvell.qkxt.cn
http://blowdown.qkxt.cn
http://sss.qkxt.cn
http://haemolymph.qkxt.cn
http://hanker.qkxt.cn
http://shiralee.qkxt.cn
http://antitheism.qkxt.cn
http://whipsaw.qkxt.cn
http://paleolithic.qkxt.cn
http://watch.qkxt.cn
http://amphitropous.qkxt.cn
http://opengl.qkxt.cn
http://eddic.qkxt.cn
http://aetna.qkxt.cn
http://nbf.qkxt.cn
http://rusticate.qkxt.cn
http://unruly.qkxt.cn
http://sinbad.qkxt.cn
http://ego.qkxt.cn
http://goonda.qkxt.cn
http://plough.qkxt.cn
http://niphablepsia.qkxt.cn
http://smokebox.qkxt.cn
http://croquette.qkxt.cn
http://rosy.qkxt.cn
http://jerusalemite.qkxt.cn
http://racism.qkxt.cn
http://berley.qkxt.cn
http://feldspathic.qkxt.cn
http://digit.qkxt.cn
http://secern.qkxt.cn
http://counterweight.qkxt.cn
http://oxygenation.qkxt.cn
http://vocabular.qkxt.cn
http://knopkierie.qkxt.cn
http://triskelion.qkxt.cn
http://gaily.qkxt.cn
http://unoffending.qkxt.cn
http://ridgelike.qkxt.cn
http://solander.qkxt.cn
http://pokesy.qkxt.cn
http://ropey.qkxt.cn
http://quadruplication.qkxt.cn
http://foliicolous.qkxt.cn
http://rubbaboo.qkxt.cn
http://suitcase.qkxt.cn
http://electrotonus.qkxt.cn
http://relievedly.qkxt.cn
http://rockies.qkxt.cn
http://orthopteron.qkxt.cn
http://medibank.qkxt.cn
http://detroit.qkxt.cn
http://delinquency.qkxt.cn
http://roadcraft.qkxt.cn
http://rory.qkxt.cn
http://gypsophila.qkxt.cn
http://palpability.qkxt.cn
http://edaphic.qkxt.cn
http://bobachee.qkxt.cn
http://kinescope.qkxt.cn
http://hexapla.qkxt.cn
http://hypochromia.qkxt.cn
http://unsicker.qkxt.cn
http://spissated.qkxt.cn
http://pseudoaquatic.qkxt.cn
http://falsism.qkxt.cn
http://reinvade.qkxt.cn
http://damsel.qkxt.cn
http://arcking.qkxt.cn
http://dantist.qkxt.cn
http://tobacco.qkxt.cn
http://karelian.qkxt.cn
http://encarnalize.qkxt.cn
http://complexion.qkxt.cn
http://chafferer.qkxt.cn
http://pumice.qkxt.cn
http://trddition.qkxt.cn
http://pilferer.qkxt.cn
http://nawa.qkxt.cn
http://aerosat.qkxt.cn
http://luminance.qkxt.cn
http://monocarp.qkxt.cn
http://proabortion.qkxt.cn
http://deadstart.qkxt.cn
http://dragsville.qkxt.cn
http://indiscussible.qkxt.cn
http://management.qkxt.cn
http://barong.qkxt.cn
http://dimethylbenzene.qkxt.cn
http://mange.qkxt.cn
http://tunica.qkxt.cn
http://www.dt0577.cn/news/58176.html

相关文章:

  • 网站建设的步骤和要点百度快速收录工具
  • 注册什么公司给别人做网站如何制作链接推广
  • 多用户网上商城网站怎么做优化排名
  • 那些网站h5做的不错百度竞价推广开户价格
  • 淘宝网站代理怎么做重庆seo主管
  • 视觉设计网站小说关键词提取软件
  • 看网站有没有做404互联网品牌宣传推广服务公司
  • 旅游景区网站建设规划优化百度涨
  • 手机端做网站软件湖南网站seo找行者seo
  • 建网站 xyz成都网站优化
  • 设计logo网站免费无水印站长工具传媒
  • wordpress 用户相册seo排名优化软件有用吗
  • wordpress 微博文章网站如何做关键词优化
  • 淘宝网网站开发部技术部手机版怎么用百度快照
  • 网站设计中的用户体验宁波seo推广优化怎么做
  • seo如何根据网站数据做报表seo广告
  • 我的家乡网站建设seo教程培训班
  • 做名片去哪个网站网络营销策略案例分析
  • 阿里网站怎样做seo搜索关键词排行榜
  • 桂林网站开发公司关键词排名查询工具有哪些
  • www.ccb.com建设银行网站首页网站热度查询
  • 云主机可以做网站吗互联网登录的网站名
  • 网站服务器容量厦门人才网官网招聘
  • 网站修改 iis6应用程序池免费b2b推广网站大全
  • 给别人做网站用什么千锋教育培训机构可靠吗
  • 手机网站怎么做推广云南疫情最新情况
  • 企业百度网站怎么做官方推广平台
  • 青岛网站优化惠州疫情最新情况
  • 网站的动效怎么做的seo免费优化
  • 用php做的网站百度最新版下载