Tortoise Method:

Use two pointers, one from front and one from back and find the point where they meet.

Again start the first pointer from start and second pointer from the intersection point found in step above, and where ever these two will meet is the duplicate number.

--

--

Convert arrayList to array in java:for 1 d array: 
//al is arrayList
Integer[] arr = new int[al.size()];
arr = al.toArray(arr);
for 2 d array:
Integer[][] arr = new int[al.size()][];
arr = al.toArray(arr);
Java:
Arrays.sort(intervals,
(arr1,arr2)->Integer.compare(arr1[0],arr2[0]));
or
Arrays.sort(intervals, (a1,a2)-> a1[0]- a2[0]);
Arrays.sort(intervals,
Collections.reverseOrder((arr1,arr2)->Integer.compare(arr1[0],arr2[0])));
Python:list_name.sort(key=lambda x:x[0],reverse=False)

--

--

Deleting a branch LOCALLY

git checkout main

Delete a branch with git branch -d <branch>.

For example: git branch -d fix/authentication

The -d option will delete the branch only if it has already been pushed and merged with the remote branch. Use -D instead if you want to force the branch to be deleted, even if it hasn't been pushed or merged yet.

The branch is now deleted locally.

Deleting a branch REMOTELY

Here’s the command to delete a branch remotely: git push <remote> --delete <branch>.

For example: git push origin --delete fix/authentication

The branch is now deleted remotely.

--

--

#pip install pythonnet pyinstaller

Note: in the code where ever you are using a file directly , use the below function to call that file.

import os

def resource_path(relative_path):
try:
base_path = sys._MEIPASS
except Exception:
base_path = os.path.abspath(".")

return os.path.join(base_path, relative_path)
# resultObj = parseXML(resource_path(xmlName))
# instead of #resultObj = parseXML(xmlName)

then:
pyinstaller — onefile hello.py

Or to add files in the same .exe

pyinstaller — onefile — add-data “*.xml;.” hello.py

--

--