From e9e02c015dbeaa8b28fd62bb43d19bf35c008834 Mon Sep 17 00:00:00 2001 From: ashish007kumar Date: Mon, 4 May 2020 18:59:31 +0530 Subject: [PATCH] DP --- DP/Minimal moves to form a string.cpp | 32 +++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 DP/Minimal moves to form a string.cpp diff --git a/DP/Minimal moves to form a string.cpp b/DP/Minimal moves to form a string.cpp new file mode 100644 index 0000000..d6fe21b --- /dev/null +++ b/DP/Minimal moves to form a string.cpp @@ -0,0 +1,32 @@ +#include +using namespace std; +int main(){ + int t; + cin>>t; + while(t--){ + string s; + cin>>s; + int n=s.length(); + int dp[n]; + dp[0]=1; + string s1=""; + string s2=""; + s1=s1+s[0]; + for(int i=1;i