11package com .fishercoder .solutions ;
22
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- */
273public class _157 {
284public static class Solution1 {
295public int read (char []buf ,int n ) {
@@ -39,7 +15,7 @@ public int read(char[] buf, int n) {
3915 }
4016
4117private int read4 (char []buffer ) {
42- //this is afake method to makeEclipse happy
18+ //this is adummy method to makeit compile
4319return 0 ;
4420 }
4521 }