9. Palindrome Number
This commit is contained in:
30
.idea/.idea.Leetcode/.idea/workspace.xml
generated
30
.idea/.idea.Leetcode/.idea/workspace.xml
generated
@@ -88,9 +88,9 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="11f2de1c-1ee5-4aa4-91e6-11975ebd421f" name="Changes" comment="">
|
<list default="true" id="11f2de1c-1ee5-4aa4-91e6-11975ebd421f" name="Changes" comment="">
|
||||||
<change afterPath="$PROJECT_DIR$/150. Evaluate Reverse Polish Notation/150. Evaluate Reverse Polish Notation.csproj" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/9. Palindrome Number/9. Palindrome Number.csproj" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/150. Evaluate Reverse Polish Notation/Program.cs" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/9. Palindrome Number/Program.cs" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/150. Evaluate Reverse Polish Notation/Solution.cs" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/9. Palindrome Number/Solution.cs" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/.idea.Leetcode/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.Leetcode/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/.idea.Leetcode/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.Leetcode/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/Leetcode.sln" beforeDir="false" afterPath="$PROJECT_DIR$/Leetcode.sln" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/Leetcode.sln" beforeDir="false" afterPath="$PROJECT_DIR$/Leetcode.sln" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
@@ -128,6 +128,7 @@
|
|||||||
"keyToString": {
|
"keyToString": {
|
||||||
".NET Project.14. Longest Common Prefix.executor": "Run",
|
".NET Project.14. Longest Common Prefix.executor": "Run",
|
||||||
".NET Project.150. Evaluate Reverse Polish Notation.executor": "Run",
|
".NET Project.150. Evaluate Reverse Polish Notation.executor": "Run",
|
||||||
|
".NET Project.9. Palindrome Number.executor": "Run",
|
||||||
"ASKED_ADD_EXTERNAL_FILES": "true",
|
"ASKED_ADD_EXTERNAL_FILES": "true",
|
||||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||||
@@ -150,7 +151,7 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
}]]></component>
|
}]]></component>
|
||||||
<component name="RunManager" selected=".NET Project.150. Evaluate Reverse Polish Notation">
|
<component name="RunManager" selected=".NET Project.9. Palindrome Number">
|
||||||
<configuration name="101. Symmetric Tree" type="DotNetProject" factoryName=".NET Project">
|
<configuration name="101. Symmetric Tree" type="DotNetProject" factoryName=".NET Project">
|
||||||
<option name="EXE_PATH" value="" />
|
<option name="EXE_PATH" value="" />
|
||||||
<option name="PROGRAM_PARAMETERS" value="" />
|
<option name="PROGRAM_PARAMETERS" value="" />
|
||||||
@@ -1645,8 +1646,27 @@
|
|||||||
<option name="Build" />
|
<option name="Build" />
|
||||||
</method>
|
</method>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
<configuration name="9. Palindrome Number" type="DotNetProject" factoryName=".NET Project" temporary="true">
|
||||||
|
<option name="EXE_PATH" value="$PROJECT_DIR$/9. Palindrome Number/bin/Debug/net8.0/9. Palindrome Number" />
|
||||||
|
<option name="PROGRAM_PARAMETERS" value="" />
|
||||||
|
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/9. Palindrome Number/bin/Debug/net8.0" />
|
||||||
|
<option name="PASS_PARENT_ENVS" value="1" />
|
||||||
|
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
||||||
|
<option name="USE_MONO" value="0" />
|
||||||
|
<option name="RUNTIME_ARGUMENTS" value="" />
|
||||||
|
<option name="PROJECT_PATH" value="$PROJECT_DIR$/9. Palindrome Number/9. Palindrome Number.csproj" />
|
||||||
|
<option name="PROJECT_EXE_PATH_TRACKING" value="1" />
|
||||||
|
<option name="PROJECT_ARGUMENTS_TRACKING" value="1" />
|
||||||
|
<option name="PROJECT_WORKING_DIRECTORY_TRACKING" value="1" />
|
||||||
|
<option name="PROJECT_KIND" value="DotNetCore" />
|
||||||
|
<option name="PROJECT_TFM" value="net8.0" />
|
||||||
|
<method v="2">
|
||||||
|
<option name="Build" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
<recent_temporary>
|
<recent_temporary>
|
||||||
<list>
|
<list>
|
||||||
|
<item itemvalue=".NET Project.9. Palindrome Number" />
|
||||||
<item itemvalue=".NET Project.150. Evaluate Reverse Polish Notation" />
|
<item itemvalue=".NET Project.150. Evaluate Reverse Polish Notation" />
|
||||||
<item itemvalue=".NET Project.14. Longest Common Prefix" />
|
<item itemvalue=".NET Project.14. Longest Common Prefix" />
|
||||||
</list>
|
</list>
|
||||||
@@ -1662,7 +1682,7 @@
|
|||||||
<updated>1678030074860</updated>
|
<updated>1678030074860</updated>
|
||||||
<workItem from="1678030078340" duration="114000" />
|
<workItem from="1678030078340" duration="114000" />
|
||||||
<workItem from="1680804946367" duration="3697000" />
|
<workItem from="1680804946367" duration="3697000" />
|
||||||
<workItem from="1706644472303" duration="6672000" />
|
<workItem from="1706644472303" duration="7691000" />
|
||||||
</task>
|
</task>
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
|
|||||||
11
9. Palindrome Number/9. Palindrome Number.csproj
Normal file
11
9. Palindrome Number/9. Palindrome Number.csproj
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<RootNamespace>_9._Palindrome_Number</RootNamespace>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
6
9. Palindrome Number/Program.cs
Normal file
6
9. Palindrome Number/Program.cs
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
// See https://aka.ms/new-console-template for more information
|
||||||
|
|
||||||
|
using _9._Palindrome_Number;
|
||||||
|
|
||||||
|
var sol = new Solution();
|
||||||
|
Console.WriteLine(sol.IsPalindrome(0));
|
||||||
25
9. Palindrome Number/Solution.cs
Normal file
25
9. Palindrome Number/Solution.cs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
namespace _9._Palindrome_Number;
|
||||||
|
|
||||||
|
public class Solution
|
||||||
|
{
|
||||||
|
public bool IsPalindrome(int x)
|
||||||
|
{
|
||||||
|
if (x < 0)
|
||||||
|
return false;
|
||||||
|
if (x < 10)
|
||||||
|
return true;
|
||||||
|
List<byte> digits = new List<byte>(32);
|
||||||
|
while (x != 0)
|
||||||
|
{
|
||||||
|
digits.Add((byte)(x%10));
|
||||||
|
x /= 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
int half = digits.Count / 2;
|
||||||
|
for (int i = 0; i < half; i++)
|
||||||
|
if (digits[i] != digits[digits.Count - 1 - i])
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -169,6 +169,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "14. Longest Common Prefix",
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "150. Evaluate Reverse Polish Notation", "150. Evaluate Reverse Polish Notation\150. Evaluate Reverse Polish Notation.csproj", "{10A95EED-FD1D-40E7-B9E0-2DD48BE05AB9}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "150. Evaluate Reverse Polish Notation", "150. Evaluate Reverse Polish Notation\150. Evaluate Reverse Polish Notation.csproj", "{10A95EED-FD1D-40E7-B9E0-2DD48BE05AB9}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "9. Palindrome Number", "9. Palindrome Number\9. Palindrome Number.csproj", "{1397373A-47E9-4E22-8FE5-82376C7FACA1}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@@ -507,6 +509,10 @@ Global
|
|||||||
{10A95EED-FD1D-40E7-B9E0-2DD48BE05AB9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{10A95EED-FD1D-40E7-B9E0-2DD48BE05AB9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{10A95EED-FD1D-40E7-B9E0-2DD48BE05AB9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{10A95EED-FD1D-40E7-B9E0-2DD48BE05AB9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{10A95EED-FD1D-40E7-B9E0-2DD48BE05AB9}.Release|Any CPU.Build.0 = Release|Any CPU
|
{10A95EED-FD1D-40E7-B9E0-2DD48BE05AB9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{1397373A-47E9-4E22-8FE5-82376C7FACA1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{1397373A-47E9-4E22-8FE5-82376C7FACA1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{1397373A-47E9-4E22-8FE5-82376C7FACA1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{1397373A-47E9-4E22-8FE5-82376C7FACA1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
Reference in New Issue
Block a user