Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f8733e8

Browse files
update
1 parent a0f9135 commit f8733e8

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

‎c/000-099/55-jump-game.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
*/
77

88
#include <stdbool.h>
9-
#include "c/test.h"
109
#include "c/data-structures/array.h"
10+
#include "c/test.h"
1111

1212
bool canJump(int *nums, int numsSize) {
1313
int flag = 0;
14-
for (int i = numsSize-2; i >= 0; i--) {
15-
flag = nums[i] <= flag ? flag+1 : 0;
14+
for (int i = numsSize-2; i >= 0; i--) {
15+
flag = nums[i] <= flag ? flag+1 : 0;
1616
}
1717

1818
return flag == 0;

‎c/200-299/221-maximal-square.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111

1212
#define MIN(a, b) ((a) <= (b) ? (a) : (b))
1313
#define MAX(a, b) ((a) >= (b) ? (a) : (b))
14-
int maximalSquare(char **matrix, int matrixRowSize, int matrixColSize) {
14+
int maximalSquare(char **matrix, int matrixSize, int *matrixColSize) {
1515
int rtn = '0';
16-
for (int i = 0; i < matrixRowSize; ++i) {
17-
for (int j = 0; j < matrixColSize; ++j) {
16+
for (int i = 0; i < matrixSize; ++i) {
17+
for (int j = 0; j < matrixColSize[0]; ++j) {
1818
if (matrix[i][j] != '0') {
1919
if (i > 0 && j > 0)
2020
matrix[i][j] = MIN(MIN(matrix[i-1][j], matrix[i][j-1]), matrix[i-1][j-1]) + 1;
@@ -30,7 +30,7 @@ int maximalSquare(char **matrix, int matrixRowSize, int matrixColSize) {
3030
void test(int expect, const char *str) {
3131
arrayEntry *e = arrayParse2D(str, ARRAY_CHAR);
3232

33-
EXPECT_EQ_INT(expect, maximalSquare(arrayValue(e), arrayRow(e), arrayCol(e)));
33+
EXPECT_EQ_INT(expect, maximalSquare(arrayValue(e), arrayRow(e), arrayCols(e)));
3434

3535
arrayFree(e);
3636
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /