We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Append and Delete
Append and Delete
Sort by
recency
|
1450 Discussions
|
Please Login in order to post a comment
Here is append and delete problem solution in python, java, c++, c and javascript - https://programmingoneonone.com/hackerrank-append-and-delete-problem-solution.html
C++
Step-by-step Solution in C++ :-
1.Find the common prefix length.
2.Calculate how many characters need to be deleted from s and added to reach t.
3.Check if k is enough to do that and whether the leftover operations can be used meaninglessly.
Java ::
public static String appendAndDelete(String s, String t, int k) { // Write your code here int n = s.length(); int m = t.length(); int i = 0; char[] a = s.toCharArray();
if i´m not mistaken these tests are wrong, please if i'm wrong help me to understand my mistake