Leetcode c语言
Leetcode上的学习笔记
小岛上的斑马
此处省略两万字。。。
展开
-
Leetcode C语言 罗马数字转整数
#include<stdio.h>void calc(int index);int romanToInt(char * s,int* index);int findIndex(char x);void minusCalc(int index,int nextIndex,int* currIndex);int nums[] = {1,5,10,50,100,500,1000};int result = 0;int main(){ int index = 0; ch.原创 2021-03-10 18:58:32 · 107 阅读 · 0 评论 -
Leetcode C语言 回文数
bool isPalindrome(int x){ if(x<0){ return false; }else{ int re = reverse(x); if(re == x){ return true; }else{ return false; } }}//以下借用整数翻转代码块int reverse(int x){ long num.原创 2021-03-10 17:41:48 · 91 阅读 · 0 评论 -
Leetcode C语言 整数反转
int reverse(int x){ long num = 0; while(x != 0){ int temp = x % 10; x = x / 10; num = num * 10 + temp; } if(num > 2147483647 || num < -2147483648){ return 0; }else{.原创 2021-03-10 17:39:53 · 81 阅读 · 0 评论 -
Leetcode C语言 两数之和
int* twoSum(int* nums, int numsSize, int target, int* returnSize){ int i,j; int *result=NULL; for(i=0;i<numsSize-1;i++) { for(j=i+1;j<numsSize;j++) { if(nums[i]+nums[j]==target) { .原创 2021-03-10 17:37:54 · 152 阅读 · 0 评论