MCPcopy Create free account
hub / github.com/SR-Sunny-Raj/Hacktoberfest2021-DSA / reverse

Method reverse

11. Stack/reverseStringStackGFG.java:28–38  ·  view source on GitHub ↗
(String S)

Source from the content-addressed store, hash-verified

26 return stack.pop();
27 }
28 public String reverse(String S){
29 //code here
30 Stack<Character> stack = new Stack<Character>();
31 String revStr = new String();
32 for(int i=0; i<S.length(); i++)
33 push(stack, S.charAt(i));
34 for(int i=0; i<S.length(); i++)
35 revStr = revStr+pop(stack);
36
37 return revStr;
38 }
39
40}

Callers 3

mainMethod · 0.95
infixToPreFixMethod · 0.45

Calls 2

pushMethod · 0.95
popMethod · 0.95

Tested by

no test coverage detected