Question: i implemeted the code that was suppodely fixed and so i ran it with the test cases and im still getting the same failures import
i implemeted the code that was suppodely fixed and so i ran it with the test cases and im still getting the same failures
import java.util.HashSet; public class Task DO NOT change this field private HashSet strings; DO NOT change this method public void setStringsHashSet stringSet strings stringSet; DO NOT change the signature for this method This method does not need to be recursive public boolean stringSum for String string : strings if isConstructablestring string return true; return false; This method MUST be recursive You can change the name and parameters of this method private boolean isConstructableString aim, String initial return isConstructableHelperaim new HashSet initial; private boolean isConstructableHelperString aim, HashSet visited, String initial if aimisEmpty return true; if visitedcontainsaim return false; visited.addaim; for String string : strings if string.equalsinitial && aim.startsWithstring String remaining aim.substringstringlength; if isConstructableHelperremaining visited, initial return true; visited.removeaim; Backtrack return false; public class Task DO NOT change this field private int map; DO NOT change this method public void setMapint grid map grid; DO NOT change the signature for this method This method does not need to be recursive public int digint battery int maxGold ; for int col ; col maplength; col maxGold Math.maxmaxGold maximumGoldFrom col, battery, new booleanmaplengthmaplength; return maxGold; private int maximumGoldFromint y int x int battery, boolean visited if battery y y map.length x x maplength visitedyx return ; visitedyx true; Mark cell as visited int gold mapyx; Get gold at current cell int maxGold ; Explore all directions Left Right, Down, Up maxGold Math.maxmaxGold gold maximumGoldFromy x battery visited; Left maxGold Math.maxmaxGold gold maximumGoldFromy x battery visited; Right maxGold Math.maxmaxGold gold maximumGoldFromy x battery visited; Down maxGold Math.maxmaxGold gold maximumGoldFromy x battery visited; Up visitedyx false; Backtrack return maxGold;
@Test
public void StringSumHelper
Tasktnew Task;
HashSet strings new HashSet;
strings.add;
strings.addSEAN;
tsetStringsstrings;
boolean output tstringSum;
assertEqualsfalseoutput;
@Test
public void DigTest
Tasktnew Task;
intmap new int
new int
new int
new int
new int
new int
;
tsetMapmap;
assertEqualstdig;
@Test
public void DigTest
Tasktnew Task;
intmap
new int
new int
new int
;
tsetMapmap;
assertEqualstdig;
public void DigTest
Tasktnew Task;
intmap
new int
new int
new int
;
tsetMapmap;
assertEqualstdig;
@Test
public void DigTest
Tasktnew Task;
intmap
new int
new int
new int
;
tsetMapmap;
assertEqualstdig;
all these are failing DigTestorgopentestjAssertionFailedError: Expected :Actual :DigTestorgopentestjAssertionFailedError: Expected :Actual :DigTestorgopentestjAssertionFailedError: Expected :Actual :DigTestorgopentestjAssertionFailedError: Expected :Actual :StringSumHelperorgopentestjAssertionFailedError: Expected :false Actual :true
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
