Home » Java » Google FooBar challenge showing Blacklisted_Code error [closed]

Google FooBar challenge showing Blacklisted_Code error [closed]

Posted by: admin December 28, 2021 Leave a comment

Questions:

I stumbled upon the Google Foo Bar challenge today. While solving the first question which was pretty simple –> Involved creating concatenation of all prime numbers in String, let’s call it as primeString, and then just taking 5 lettered substring from that primeString from given index i.

I was happy that it was easy and tried approach of generating prime numbers using Sieve. It showed the error shown in the image below. I also tried normal brute force method of generating prime numbers, again it showed the same error.

I am using Java language to solve it. I am using an online Java compiler as IDE and then I copy-pasted my code into the editor since the default editor does not have any code compilation feature.

I searched throughout the meaning of this error. I couldn’t find any solution. Can someone please explain to me what this error is?

verify Solution.java error

Answers:

I came across the constraint.txt file in the challenge which had the below rules for Java:

Java Constraints

So based on the point highlighted, I had used import java.utils.* wildcard import statement in my java code. Wildcard imports would constitute Blacklisted code, which was why I was getting the error. Thanks everyone for your help.