[Solved] Find the longest string

We can do this in two lines of code: List<String> list = Arrays.asList(letterlist); String longest = Arrays.stream(letterlist).max(Comparator.comparingInt(String::length)).get(); Demo Inspired by this Code Review question: https://codereview.stackexchange.com/questions/75807/finding-the-longest-string-and-its-length-using-java-streams 0 solved Find the longest string

[Solved] What will be the output in C? [duplicate]

Warning, long winded answer ahead. Edited to reference the C standard and to be clearer and more concise with respect to the question being asked. The correct answer for why you have 32 has been given a few times. Explaining the math using modular arithmetic is completely correct but might make it a little harder … Read more

[Solved] Real projects on .Net Core [closed]

Whilst I agree that this is not the correct forum for such a question, a quick and simple Google search suggests that https://www.ageofascent.com/ is built on .Net Core to some degree. Additionally, although not quite what you’re looking for, .Net Core is supported in lots of Windows Docker containers running Windows Server Core, due to … Read more

[Solved] My Java code is not running [closed]

As others stated before, value of remainder is set only once. However, you check it a hundred times expecting it to tell you something else every time. I’d suggest putting it inside a loop, so you get a “fresh” value for every number. public class Even { public static void main(String args[]) { int number … Read more

[Solved] I want to display words separate from a sentence

sentence = “Get a sentence from the user and display it back with one word per line.” for character in range(len(sentence)): if sentence[character] == ‘ ‘ or sentence[character] == ‘.’ or sentence[character] == ‘,’: print(“”) else: print(sentence[character], end=”) OUTPUT: Get a sentence from the user and display it back with one word per line solved … Read more

[Solved] Print function values [closed]

import numpy as np x_range = np.arange(-3, -0.8, 0.2) for x in x_range: y = (x**2)/2 – 4*x print(“{:.2f} -> {:.2f}”.format(x, y)) if you want to store the y values for each x: import numpy as np x_range = np.arange(-3, -0.8, 0.2) y_vals = [] for x in x_range: y = (x**2)/2 – 4*x y_vals.append(y) … Read more

[Solved] Not importing shape in python

the logic of the posted code is flawed, you set the turtle object at the beginning and it appears (as it should). but then you use an endless loop that update the object but there is nothing to update. so the code after the loop is never executed -> no shape will appear So doing … Read more

[Solved] how to convert string to date or date to string [closed]

Resum_Controls_Data_txt is type of String not Date, so you have to convert date to string using DateFormatter as follow: let formatter = DateFormatter() formatter.locale = Locale(identifier: “en_US_POSIX”) formatter.dateFormat = “HH:mm E, d MMM y” //add date format whichever you want cell.Resum_Controls_Data_txt.text = formatter.string(from: control.data) 2 solved how to convert string to date or date to … Read more

[Solved] Difference between & and * [duplicate]

&p gets the pointer to the integer p -> That is, the memory address in which p is stored. *p “dereferences” the pointer, i.e. looks at the object at the memory address provided by p and returns that object. Your code above is invalid C, as you cannot dereference an int: error: indirection requires pointer … Read more