Karthikeya Boyini has Published 2193 Articles

Array Declarations in Java

karthikeya Boyini

karthikeya Boyini

Updated on 18-Jun-2020 09:24:40

914 Views

Here is the syntax for declaring an array variable −SyntaxdataType[] arrayRefVar;   // preferred way. or dataType arrayRefVar[];  // works but not preferred way.Note − The style dataType[] arrayRefVar is preferred. The style dataType arrayRefVar[] comes from the C/C++ language and was adopted in Java to accommodate C/C++ programmers.ExampleThe following ... Read More

How to add binary numbers using Python?

karthikeya Boyini

karthikeya Boyini

Updated on 17-Jun-2020 14:39:15

682 Views

If you have binary numbers as strings, you can convert them to ints first using int(str, base) by providing the base as 2. Then add the numbers like you'd normally do. Finally convert it back to a string using the bin function. For example, a = '001' b = '011' ... Read More

How to use single statement suite with Loops in Python?

karthikeya Boyini

karthikeya Boyini

Updated on 17-Jun-2020 12:29:42

394 Views

Similar to the if statement syntax, if your while clause consists only of a single statement, it may be placed on the same line as the while header. Here are the syntax and example of a one-line for loop:for i in range(5): print(i)This will give the output:0 1 2 3 ... Read More

How to do twos complement on a 16-bit signal using Python?

karthikeya Boyini

karthikeya Boyini

Updated on 17-Jun-2020 11:53:54

1K+ Views

If you want to get an inversion of only first 16 bits of a number, you can take a xor of that number with 65535(16 1s in binary). Forgetting a 2s complement, just add one to the result. For example, Examplea = 3 # 11 in binary b = (a ... Read More

Simpson's 1/3 Rule for definite integral

karthikeya Boyini

karthikeya Boyini

Updated on 17-Jun-2020 08:45:38

1K+ Views

Like the Trapezoidal Rule, Simpson’s 1/3rd rule is also used to find the integral value from the range a to b. The main difference between trapezoidal and the Simpson’s 1/3rd rule is, in the trapezoidal rule, the whole sections are divided into some trapezoids, but in this case, each trapezoid ... Read More

Lucky Numbers

karthikeya Boyini

karthikeya Boyini

Updated on 17-Jun-2020 08:23:49

2K+ Views

Lucky numbers are some special integer numbers. From basic numbers, some special numbers are eliminated by their position. Instead of their value, for their position, the numbers are eliminated. The numbers which are not deleted, they are the lucky numbers.The number deletion follows some rule. At first, every second number ... Read More

Word Wrap Problem

karthikeya Boyini

karthikeya Boyini

Updated on 17-Jun-2020 07:54:57

2K+ Views

A sequence of words is given, there is a limit on the number of characters for each line. By putting line breaks, in such a way that lines are printed clearly.The lines must be balanced, when some lines have lots of extra spaces and some lines are containing a small ... Read More

Evaluate Postfix Expression

karthikeya Boyini

karthikeya Boyini

Updated on 17-Jun-2020 07:45:37

9K+ Views

For solving a mathematical expression, we need prefix or postfix form. After converting infix to postfix, we need postfix evaluation algorithm to find the correct answer.Here also we have to use the stack data structure to solve the postfix expressions.From the postfix expression, when some operands are found, pushed them ... Read More

Minimum Number of Jumps Problem

karthikeya Boyini

karthikeya Boyini

Updated on 17-Jun-2020 07:43:14

851 Views

In this problem, a list of positive integers is given. Each integer is denoting that how many maximum steps that can be made from the current element. Starting from the first element, we have to find the minimum number of jumps to reach the end item of the list.For the ... Read More

CSS max-width property

karthikeya Boyini

karthikeya Boyini

Updated on 17-Jun-2020 07:42:07

135 Views

The max-width property is used to set the maximum width that a box can be. The value of the max-width property can be a number, a length, or a percentage.                            This paragraph is 200px high and max ... Read More

Advertisements