Found 27104 Articles for Server Side Programming

How to Decode the string encoded with the given algorithm?

Sonal Meenu Singh
Updated on 03-Oct-2023 10:29:04

167 Views

Introduction Encoding means converting the text into some form of representation, and decoding is the process of converting the encoded text into its original form. Encoding and decoding are two interrelated techniques for transferring information from one form to another. In this tutorial, we implement an approach to decode the string which is encoded with the given algorithm that finds the decoded string using an encoded string encoded with some algorithm. The string is encoded using the following concept − For example string = India Encoded string = dniIa In the string "India", the middle character is 'd', ... Read More

Count of all substrings with sum of weights at most K

Sonal Meenu Singh
Updated on 29-Sep-2023 17:36:18

248 Views

Introduction In this tutorial, we discuss the problem of counting the substrings from a given string with the sum of weights at most K. To implement the problem statement we consider a string S to generate substrings and some value for k. The character weights are predefined integer values and we consider some value of K like 2, 3 or anything. We count only those substrings whose total weight is equal to the value of K. The weights of the characters are defined in two different ways − When the weights are defined for a string in any order. ... Read More

Check whether the string can be printed using same row of qwerty keypad

Sonal Meenu Singh
Updated on 29-Sep-2023 17:33:46

69 Views

Introduction In this tutorial, we will check if an input string can be formed using characters in the same row of the Qwerty keypad. The task is to check whether a given string exists in a single row of the Qwerty keypad. To determine whether a string can be printed with the same row of the Qwerty keypad, all characters should be found in the same row. We implement an approach using set and unordered_set to solve this task. The characters of different rows are stored in different sets or unordered_sets. Compare the string characters to each stored row value. ... Read More

Check if a substring can be Palindromic by replacing K characters for Q queries

Sonal Meenu Singh
Updated on 29-Sep-2023 17:08:38

123 Views

Introduction In this tutorial, we implement an approach to check substring is palindrome by replacing its K characters for Q queries. Palindromes are words that read the same in both directions. When you read a palindromic word from a forward or backward direction, it sounds the same. For example, madam, refer. Here, Q queries are a numeric array containing the starting index, ending index, and value of K. The starting and ending index values for the input string are used to select only those characters that lie between these starting and ending index values (both values are inclusive). For the ... Read More

What is Numpy Gradient in Descent Optimizer of Neural Networks?

Someswar Pal
Updated on 29-Sep-2023 12:04:48

124 Views

Understanding Neural Networks In the context of neural networks, the goal is to find the optimal set of weights and biases that minimize the difference between the predicted outputs of the network and the true outputs. Optimization Gradient descent optimization works by iteratively updating the network parameters in the opposite direction of the gradient of the loss function with respect to those parameters. The gradient points in the direction of the steepest increase in the loss function, so by moving in the opposite direction, the algorithm can gradually converge toward the minimum of the loss function. There are variegated variants ... Read More

How to Concatenate Column Values in a Pandas DataFrame?

Mukul Latiyan
Updated on 28-Sep-2023 14:50:47

3K+ Views

Pandas is a powerful library for data manipulation and analysis in Python. It provides a variety of functions and tools for handling and transforming data, including the ability to concatenate column values in a Pandas DataFrame. In a Pandas DataFrame, columns represent variables or features of the data. Concatenating column values involves combining the values of two or more columns into a single column. This can be useful for creating new variables, merging data from different sources, or formatting data for analysis. To concatenate column values in a Pandas DataFrame, you can use the pd.Series.str.cat() method. This method concatenates two ... Read More

How to Collapse Multiple Columns in Python Pandas?

Mukul Latiyan
Updated on 28-Sep-2023 14:46:52

1K+ Views

Pandas is a popular data manipulation library in Python that is widely used for working with structured data. One of the common tasks when working with data is to clean and transform it in order to prepare it for analysis. Sometimes, the data might contain multiple columns that have similar information or are related to each other. In such cases, it might be useful to collapse these columns into a single column for easier analysis or visualization. Pandas provides several methods to collapse multiple columns into a single column. In this tutorial, we will explore these methods in detail and ... Read More

Circle of Squares using Python Turtle

Mukul Latiyan
Updated on 28-Sep-2023 14:40:32

1K+ Views

The Circle of Squares is a fascinating geometric pattern that can be created using Python's turtle graphics library. This pattern consists of a circle of squares that are evenly spaced around its circumference, with each square rotated at an angle relative to the previous square. This creates a mesmerizing visual effect that can be customized to suit any color scheme or size. In this tutorial, we will explore how to create the Circle of Squares pattern using Python's turtle library, step by step. We will also discuss different customization options that can be applied to create unique variations of the ... Read More

Centered Pentadecagonal Number

Rinish Patidar
Updated on 27-Sep-2023 16:04:39

123 Views

The problem includes printing the N-th centered pentadecagonal number for any input number N. A centered pentadecagonal number is a number that can be represented in the form of a figure with a dot in the centre and surrounded by successive layers of the pentadecagon i.e. 15-sided polygon. Here the successive layers of the pentadecagon depict that the first layer surrounding the dot in the centre will be 15-sided polygon, the next layer will be 30-sided polygon followed by a 45-sided polygon and so on. We can understand the concept of centered pentadecagonal with the below figures. The first ... Read More

Centered Octagonal Number

Rinish Patidar
Updated on 27-Sep-2023 15:51:40

139 Views

The problem statement includes printing the N-th centered octagonal number for some positive integer N, which will be given by the user. A centered octagonal number is a type of number which can be represented in a pattern of figures. Every centered octagonal number can be represented as a dot in the centre surrounded by the successive layers of an Octagon. An octagon is a type of polygon in geometry which has 8 sides in it. The successive layers of an octagon means that the first layer surrounding the dot in the centre will be an octagon, the second ... Read More

Advertisements