subject

Write a function called backspaceCompare that takes two strings sl and s2 and evaluate them when both are typed into empty text editors. (# means a backspace character). backspacecompare should return true if the evaluated strings are equal or false if they are not equal. You should make use of the built-in java implementation of the stack data structure under java. util. Stack . (assume that the user inputs correct strings)
Example 1:
Input : s1 = "Datastructure si###Fun", s2 = "Datastructures Iszwp###Fun"
Output: true
Explanation: Both s1 and s2 become "DataStructuresIsFun".
Example 2:
Input : S = "abc##, T = "wc#d#"
Output: false
Explanation: s1 becomes "a" while s2 becomes "w"
Function Template
import java. util. Stack;
public class Lab3 {
public static void main (String[] args) {
String s1 = "Dat astructure si###Fun";
String s2 = "Dat astructure s1szwp###Fun";
boolean ans = backspaceCompare(s1, s2);
System. out. println (ans); // Should be True
}
public static boolean backspaceCompare(String s1, String s2) {
Stack s1 stack = new Stack();
Stack s2 stack = new Stack();
// Example of push stack. push("D")
// Example of peek stack. peek()
// Example of pop stack. pop()
// Example of Ä°sEmpty stack. isEmpty()
// INSERT YOUR CODE HERE
}
}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 01:30
In deadlock avoidance using banker’s algorithm, what would be the consequence(s) of: (i) a process declaring its maximum need as maximum possible for each resource. in other words, if a resource a has 5 instances, then each process declares its maximum need as 5. (ii) a process declaring its minimum needs as maximum needs. for example, a process may need 2-5 instances of resource a. but it declares its maximum need as 2.
Answers: 3
question
Computers and Technology, 24.06.2019 15:20
Local area networks use many of the same network technologies and the internet, only on a smaller scale. devices that access lans are equipped with a network interface that contains circuitry for wireless or wired connections. devices also have a physical address, in addition to the ip addresses acquired from a dhcp server. the most popular wired technology is . the most popular wireless technology is , which can be configured as a(n) or star topology. setting up a lan and configuring its router is fairly easy. the first step is to change the standard to one that is secure. next, create a(n) that uniquely identifies the network by name. it is also important to activate wireless to prevent wireless signals from being intercepted during transmission. a limited-access network can be created for visitors to use. by activating , the router will be able to assign ip addresses to each device that joins the network. to connect to a secure lan that is protected by encryption, an encryption , or password, is required. lans can be used to access data collected by iot devices and the networks that tie these devices together. technologies such as rfid, nfc, bluetooth smart, zigbee, and z-wave offer -power links, essential for battery-powered devices that can’t expend excess amounts of energy transmitting data.
Answers: 1
question
Computers and Technology, 24.06.2019 23:00
Hypertension occurs when blood pressure is too high.
Answers: 1
question
Computers and Technology, 25.06.2019 19:40
During the installation of ad rms during this lab, you installed ad rms with windows internal database (wid). however, your manager asks why you did not produce the same environment that would be used in production, including using a dedicated sql server. she wants to know the advantages a dedicated sql server provides when backing up and restoring ad rms and how this backup affects the actual documents that are protected with ad rms.
Answers: 1
You know the right answer?
Write a function called backspaceCompare that takes two strings sl and s2 and evaluate them when bot...
Questions
question
Chemistry, 01.07.2020 15:01
question
Mathematics, 01.07.2020 15:01
question
Mathematics, 01.07.2020 15:01
question
Mathematics, 01.07.2020 15:01
question
History, 01.07.2020 15:01
Questions on the website: 13722361