We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e669ccf commit f321827Copy full SHA for f321827
leetcodeQuestions/leetcode66.java
@@ -0,0 +1,35 @@
1
+package test;
2
+
3
+import java.math.BigInteger;
4
5
+public class cla {
6
+ static int count =0;
7
+ public static int[] plusOne(int[] nums) {
8
9
+ StringBuilder sb = new StringBuilder("");
10
+ for(int i=0 ;i<nums.length;i++)
11
+ {
12
+ sb.append(nums[i]+"");
13
+ }
14
+ BigInteger bg = new BigInteger(sb+"");
15
+ BigInteger bg1= new BigInteger("1");
16
+ String s= (bg.add(bg1))+"";
17
+ System.out.println("s is "+s);
18
19
+ int arr[] = new int [s.length()];
20
+ for( int i=0 ; i< s.length();i++){
21
+ arr[i]=((int)s.charAt(i))-48;
22
23
+ return arr;
24
25
26
+ public static void main(String[] args) {
27
+ int[] arr= {9,9,9};
28
+ int brr[]= plusOne(arr);
29
+ for(int i : brr) {
30
+ System.out.print(i+" ");
31
32
33
34
35
+}
0 commit comments