Skip to content

Commit f321827

Browse files
committed
adding files
1 parent e669ccf commit f321827

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

leetcodeQuestions/leetcode66.java

+35
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)