- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 34488 Articles for Programming
![Shubham Vora](https://www.tutorialspoint.com/assets/profiles/485898/profile/60_1456867-1657516792.jpeg)
72 Views
In this problem, we need to right-shift each character of a given string by its frequency. To solve the problem, we can count the frequency of each character and store it in a data structure like an array or map. After that, we can use the ASCII values of the characters to right-shift each character by their frequency. Problem statement- We have given string str containing lowercase characters and a length equal to N. We need to right-shift each character of the string by the frequency of that particular character in the given string. Sample examples Input – str = ‘tutorialspoint’ ... Read More
![Shubham Vora](https://www.tutorialspoint.com/assets/profiles/485898/profile/60_1456867-1657516792.jpeg)
130 Views
In this problem, we need to construct the str2 by using the subsequences of the str1. To solve the problem, we can find subsequences of the str1 so that it can cover the substring with a maximum length of str2. Here, we will learn two different approaches to solving the problem. Problem statement – We have given two strings, str1, and str2, of different lengths. We need to construct the str2 from the str1 by following the condition below. Pick any subsequence from the str1, and append it to the new string, which is empty initially. We need to return ... Read More
![Shubham Vora](https://www.tutorialspoint.com/assets/profiles/485898/profile/60_1456867-1657516792.jpeg)
83 Views
In this problem, we have given a string containing 0, 1, and ? characters. We need to find permutations of the string by replacing ‘?’ with 0 and 1. The logic to solve the problem is that we can replace every ‘?’ with either 0 or 1. So, by replacing one ‘?’, we can generate two different permutations, and by replacing N ‘?’ with 2 possibilities, we can generate 2^N permutations. In this tutorial, we will learn two different approaches to solving the given problem. Problem statement – We have given string str containing ‘0’, ‘1’ and ‘?’ characters. We ... Read More
![Shubham Vora](https://www.tutorialspoint.com/assets/profiles/485898/profile/60_1456867-1657516792.jpeg)
63 Views
In this problem, we need to select the pair of strings and swap their first character. After that, we need to count the total number of new pairs. We can solve the problem by swapping the first character of each pair and checking whether it exists in the array. The efficient approach to solve the problem can be using the hashmap data structure. Problem statement – We have given an array containing N strings. We can take any of two strings from all array elements and swap the first characters of both strings. We need to count the total ... Read More
![Shubham Vora](https://www.tutorialspoint.com/assets/profiles/485898/profile/60_1456867-1657516792.jpeg)
51 Views
In this problem, we have given the array of integers. We need to combine all elements in a single integer and check if it is a Harshad number. Before we move with the solution, let’s understand Harshad number. All numbers are Harshad numbers which are divisible by the sum of their digits. For example, 12 is Harshad number, as 12 is divisible by 3 = 1 + 2. To solve the problem, we can combine all array elements, and after that, we can check whether the resultant number is the Harshad number. Problem statement – We have given an array ... Read More
![Shubham Vora](https://www.tutorialspoint.com/assets/profiles/485898/profile/60_1456867-1657516792.jpeg)
141 Views
In this problem, we need to check if we can make all characters of strings equal by increment and decrement operations. We can get the weight of each character based on their ASCII values and check whether the total weight can be used to make all characters equal. Problem statement – We have given string str of length N containing lowercase alphabetical characters. We need to check whether we can make all characters of the string equal by choosing any of two characters, increasing one, and decreasing another by 1. If possible, print ‘yes’, else ‘no’. Sample examples Input– ... Read More
![Atharva Shah](https://www.tutorialspoint.com/assets/profiles/626166/profile/60_735606-1679646268.png)
614 Views
Python dictionaries are flexible data structures that hold key-value pairs effectively. A nested dictionary is a hierarchical data structure to organize and manage large amounts of data. This article shows how to construct a nested dictionary from a given list, enabling dictionary users to perform a variety of tasks. Syntax Nest multiple levels of dictionaries to accommodate complex data structures. nested_dict = { 'outer_key': { 'inner_key': 'value' } } Algorithm 1. Create a new dictionary to contain the layered structure. 2. Go through the given list iteratively. 3. Extract the necessary information for keys and ... Read More
![Atharva Shah](https://www.tutorialspoint.com/assets/profiles/626166/profile/60_735606-1679646268.png)
83 Views
In the realm of GUI programming, wxPython has emerged as a powerful and versatile library, empowering developers to craft stunning graphical user interfaces with ease. Among the many essential components, toolbars play a vital role in providing users with quick access to various functionalities. In this tutorial, we'll dive into the art of creating multiple toolbars using wxPython. By the end, you'll be equipped with the knowledge to enhance your GUI applications with multiple toolbars, thereby offering an improved user experience. Installation wxPython Library for GUI Prototyping As a wrapper for the C++ library wxWidgets, wxPython allows ... Read More
![Atharva Shah](https://www.tutorialspoint.com/assets/profiles/626166/profile/60_735606-1679646268.png)
508 Views
Python's key data structures are lists and tuples. Once elements of tuples are set they cannot be changed. This is called immutability. But list elements can be modified after initialization. When dealing with data that needs to be grouped together, a for loop is used to create tuple lists. Lists are more adaptable than tuples due to their ability to be modified. This tutorial demonstrates creating a list of tuples using a for loop, simplifying repetitive tasks. Syntax for variable in iterable: # loop code Basic Operations on Tuples Example # Initializing my_tuple = ... Read More
![Atharva Shah](https://www.tutorialspoint.com/assets/profiles/626166/profile/60_735606-1679646268.png)
895 Views
This walkthrough is all about creating a dictionary of tuples in Python. This data structure stores key-value pairs. By combining dictionaries and tuples, a dictionary of tuples can be created. The benefit is organized and accessible data in a structured format. Becomes easy to represent multiple values for each key, such as student grades or contact information. Let us see how this efficiently stores and retrieves complex data. Syntax Ensure Python is installed on your system for its simplicity and readability. Create a dictionary of tuples using the following syntax: dictionary_name = {key1: (value1_1, value1_2, ...), key2: ... Read More