File tree 1 file changed +1
-25
lines changed
src/main/java/com/fishercoder/solutions
1 file changed +1
-25
lines changed Original file line number Diff line number Diff line change 1
1
package com .fishercoder .solutions ;
2
2
3
- /**
4
- * 157. Read N Characters Given Read4
5
- *
6
- * The API: int read4(char *buf) reads 4 characters at a time from a file.
7
- *
8
- * The return value is the actual number of characters read. For example, it returns 3 if there is only 3 characters left in the file.
9
- *
10
- * By using the read4 API, implement the function int read(char *buf, int n) that reads n characters from the file.
11
- *
12
- * Example 1:
13
- *
14
- * Input: buf = "abc", n = 4
15
- * Output: "abc"
16
- * Explanation: The actual number of characters read is 3, which is "abc".
17
- *
18
- * Example 2:
19
- *
20
- * Input: buf = "abcde", n = 5
21
- * Output: "abcde"
22
- *
23
- * Note:
24
- * The read function will only be called once for each test case.
25
- *
26
- */
27
3
public class _157 {
28
4
public static class Solution1 {
29
5
public int read (char [] buf , int n ) {
@@ -39,7 +15,7 @@ public int read(char[] buf, int n) {
39
15
}
40
16
41
17
private int read4 (char [] buffer ) {
42
- //this is a fake method to make Eclipse happy
18
+ //this is a dummy method to make it compile
43
19
return 0 ;
44
20
}
45
21
}
You can’t perform that action at this time.
0 commit comments