数组
大团子
爱好计算机
展开
-
剑指offer--面试题13:机器人的运动范围
#include int movingCountCore(int threshold, int rows, int cols, int row, int col, bool* visited);bool check(int threshold, int rows, int cols, int row, int col, bool* visited);int getDigitSum(int原创 2017-07-11 16:20:42 · 320 阅读 · 0 评论 -
剑指offer--面试题12:矩阵中的路径
#include #include bool hasPathCore(const char* matrix, int rows, int cols, int row, int col, const char* str, int& pathLength, bool* visited);bool hasPath(const char* matrix, int rows, int cols,原创 2017-07-11 15:46:10 · 290 阅读 · 0 评论 -
剑指offer--面试题29:顺时针打印矩阵
#includevoid Print_Circle(int (*A)[3],int rows,int cols,int start){ int endX=cols-1-start; int endY=rows-1-start; //从左到右打印一行 for(int i=start;i<=endX;++i) printf("%d ",A[start][i]); //从上到下打印一列原创 2017-07-25 10:05:13 · 265 阅读 · 0 评论 -
剑指offer--面试题11:旋转数组的最小数字
#include#includeusing namespace std;int MinInOrder(int *a,int low,int high){ int result=a[low]; for(int i=low+1;i<=high;++i) { if(result>a[i]) result=a[i]; } return result;}int Min(i原创 2017-07-07 20:07:41 · 188 阅读 · 0 评论 -
剑指offer--面试题21:调整数组顺序使奇数位于偶数前面
#include void Reorder(int *pData, unsigned int length, bool (*func)(int));bool isEven(int n);void ReorderOddEven(int *pData, unsigned int length){ Reorder(pData, length, isEven);}void Reo原创 2017-07-15 15:51:47 · 162 阅读 · 0 评论 -
剑指offer--面试题3:数组中重复的数字
#includebool duplicate_1(int numbers[],int length,int *duplication){//思想:遍历数组,假设遇到数字j,则将j换到下标为j的位置上,若再遇到相同数字j,对应位置上的数字已经==j。返回。 if(numbers==NULL||length<=0) return false; for(int i=0;i<length;++原创 2017-06-26 15:19:16 · 503 阅读 · 0 评论 -
剑指offer--面试题4:二维数组中的查找
#include bool Find(int *matrix, int rows, int columns, int number) { bool found = false; if(matrix != NULL && rows >原创 2017-04-20 14:21:29 · 656 阅读 · 0 评论 -
剑指offer--面试题14:剪绳子
#include #include// ====================动态规划====================int maxProductAfterCutting_solution1(int length){ if(length < 2) return 0; if(length == 2) return 1; if原创 2017-07-12 10:32:50 · 1855 阅读 · 0 评论