Question: I wrote the code for the first pic but it's not working while the next pic has the question on it return size; 67 68
I wrote the code for the first pic but it's not working while the next pic has the question on it

return size; 67 68 I 69 1 7e 1 a function to compute: the position within the list of the second to last occurrence 71 / of the parameter: letter 72 positions are counted as an offset from the beginning. // positionofSecondTolastoccurrence 73 / 74 1 if the list contains 'a b' cd then the second to last cis in position 2 75 if letter appears either or 1 time, return -1 76 1 771 you can write this iteratively or recursively, but you should only have one loop or recursive helper I would expect ["ababc defb"].positionOfSecondToLastoc currence(.b.)"3 // 79 80 ["ababcdefb"].positionofsecondTolastoccurrencef) 1 81 82 83 public int positionofsecondTolastoccurrence (char letter) ( Node currNode first; int index ; int result1; int temp e boolean isFirstoccurence true while(currNode 1 null) ( 84 85 86 87 89 ?f(index > 2 && currNode.iten ## letter) { if(isFirstoccurence) 91 92 93 94 95 96 97 98 temp index ; isFirstoccurencefalse; else ( result temp; break; index+ currNode 100 181 102 183 currNode. next
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
